parserforxmlschema.cpp

来自「IBM的解析xml的工具Xerces的源代码」· C++ 代码 · 共 541 行 · 第 1/2 页

CPP
541
字号
            }            else {                processNext();                if ((type = getState()) == REGX_T_EOF)                    ThrowXMLwithMemMgr(ParseException,XMLExcepts::Parser_CC2, getMemoryManager());                if ((type == REGX_T_CHAR && getCharData() == chCloseSquare)                    || type == REGX_T_XMLSCHEMA_CC_SUBTRACTION) {                    static const XMLCh dashStr[] = { chDash, chNull};                    ThrowXMLwithMemMgr2(ParseException, XMLExcepts::Parser_CC6, dashStr, dashStr, getMemoryManager());                }                else {                    XMLInt32 rangeEnd = getCharData();                    XMLCh rangeEndStr[] = { rangeEnd, chNull };                    if (type == REGX_T_CHAR) {                        if (rangeEnd == chOpenSquare                            || rangeEnd == chCloseSquare                            || rangeEnd == chDash)                            // '[', ']', '-' not allowed and should be esacaped                            ThrowXMLwithMemMgr2(ParseException, XMLExcepts::Parser_CC6, rangeEndStr, rangeEndStr, getMemoryManager());                    }                    else if (type == REGX_T_BACKSOLIDUS) {                        rangeEnd = decodeEscaped();                    }                    processNext();                    if (ch > rangeEnd) {                        XMLCh chStr[] = { ch, chNull };                        ThrowXMLwithMemMgr2(ParseException,XMLExcepts::Parser_Ope3, rangeEndStr, chStr, getMemoryManager());                    }                    tok->addRange(ch, rangeEnd);                }            }        }        firstLoop = false;    }    if (getState() == REGX_T_EOF)        ThrowXMLwithMemMgr(ParseException,XMLExcepts::Parser_CC2, getMemoryManager());    tok->sortRanges();    tok->compactRanges();    setParseContext(S_NORMAL);    processNext();    return tok;}XMLInt32 ParserForXMLSchema::processCInCharacterClass(RangeToken* const tok,                                                      const XMLInt32 ch){    tok->mergeRanges(getTokenForShorthand(ch));    return -1;}Token* ParserForXMLSchema::processLook(const unsigned short) {    ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, getMemoryManager());    return 0; // for compilers that complain about no return value}Token* ParserForXMLSchema::processBacksolidus_A() {    ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, getMemoryManager());    return 0; // for compilers that complain about no return value}Token* ParserForXMLSchema::processBacksolidus_B() {    ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, getMemoryManager());    return 0; // for compilers that complain about no return value}Token* ParserForXMLSchema::processBacksolidus_b() {    ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, getMemoryManager());    return 0; // for compilers that complain about no return value}Token* ParserForXMLSchema::processBacksolidus_C() {    processNext();    return getTokenForShorthand(chLatin_C);}Token* ParserForXMLSchema::processBacksolidus_c() {    processNext();    return getTokenForShorthand(chLatin_c);}Token* ParserForXMLSchema::processBacksolidus_g() {    ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, getMemoryManager());    return 0; // for compilers that complain about no return value}Token* ParserForXMLSchema::processBacksolidus_gt() {    ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, getMemoryManager());    return 0; // for compilers that complain about no return value}Token* ParserForXMLSchema::processBacksolidus_I() {    processNext();    return getTokenForShorthand(chLatin_I);}Token* ParserForXMLSchema::processBacksolidus_i() {    processNext();    return getTokenForShorthand(chLatin_i);}Token* ParserForXMLSchema::processBacksolidus_lt() {    ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, getMemoryManager());    return 0; // for compilers that complain about no return value}Token* ParserForXMLSchema::processBacksolidus_X() {    ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, getMemoryManager());    return 0; // for compilers that complain about no return value}Token* ParserForXMLSchema::processBacksolidus_Z() {    ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, getMemoryManager());    return 0; // for compilers that complain about no return value}Token* ParserForXMLSchema::processBacksolidus_z() {    ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, getMemoryManager());    return 0; // for compilers that complain about no return value}Token* ParserForXMLSchema::processBackReference() {    ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, getMemoryManager());    return 0; // for compilers that complain about no return value}Token* ParserForXMLSchema::processCondition() {    ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, getMemoryManager());    return 0; // for compilers that complain about no return value}Token* ParserForXMLSchema::processIndependent() {    ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, getMemoryManager());    return 0; // for compilers that complain about no return value}Token* ParserForXMLSchema::processModifiers() {    ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, getMemoryManager());    return 0; // for compilers that complain about no return value}Token* ParserForXMLSchema::processParen2() {    ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, getMemoryManager());    return 0; // for compilers that complain about no return value}RangeToken* ParserForXMLSchema::parseSetOperations() {    ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Regex_NotSupported, getMemoryManager());    return 0; // for compilers that complain about no return value}// ---------------------------------------------------------------------------//  ParserForXMLSchema: Getter methods// ---------------------------------------------------------------------------Token* ParserForXMLSchema::getTokenForShorthand(const XMLInt32 ch) {    switch(ch) {    case chLatin_d:        return getTokenFactory()->getRange(fgXMLDigit);    case chLatin_D:        return getTokenFactory()->getRange(fgXMLDigit, true);    case chLatin_w:        return getTokenFactory()->getRange(fgXMLWord);    case chLatin_W:        return getTokenFactory()->getRange(fgXMLWord, true);    case chLatin_s:        return getTokenFactory()->getRange(fgXMLSpace);    case chLatin_S:        return getTokenFactory()->getRange(fgXMLSpace, true);    case chLatin_c:        return getTokenFactory()->getRange(fgXMLNameChar);    case chLatin_C:        return getTokenFactory()->getRange(fgXMLNameChar, true);    case chLatin_i:        return getTokenFactory()->getRange(fgXMLInitialNameChar);    case chLatin_I:        return getTokenFactory()->getRange(fgXMLInitialNameChar, true);    }    return 0;}// ---------------------------------------------------------------------------//  ParserForXMLSchema: Helper methods// ---------------------------------------------------------------------------bool ParserForXMLSchema::checkQuestion(const int) {    return false;}XMLInt32 ParserForXMLSchema::decodeEscaped() {    if (getState() != REGX_T_BACKSOLIDUS)        ThrowXMLwithMemMgr(ParseException,XMLExcepts::Parser_Next1, getMemoryManager());    XMLInt32 ch = getCharData();    switch (ch) {    case chLatin_n:        ch = chLF;        break;    case chLatin_r:        ch = chCR;        break;    case chLatin_t:        ch = chHTab;        break;    case chBackSlash:    case chPipe:    case chPeriod:    case chCaret:    case chDash:    case chQuestion:    case chAsterisk:    case chPlus:    case chOpenCurly:    case chCloseCurly:    case chOpenParen:    case chCloseParen:    case chOpenSquare:    case chCloseSquare:        break;    default:		{        XMLCh chString[] = {chBackSlash, ch, chNull};                ThrowXMLwithMemMgr1(ParseException,XMLExcepts::Parser_Process2, chString, getMemoryManager());        }    }    return ch;}XERCES_CPP_NAMESPACE_END/**  * End of file ParserForXMLSchema.cpp  */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?