diff --git a/src/xercesc/internal/IGXMLScanner2.cpp b/src/xercesc/internal/IGXMLScanner2.cpp index a7fcb4ef0ae08927211c056b5aa6f82159b5f32a..b89b0198c3f463cd621fae2d21a06e7c349971ca 100644 --- a/src/xercesc/internal/IGXMLScanner2.cpp +++ b/src/xercesc/internal/IGXMLScanner2.cpp @@ -94,6 +94,10 @@ XERCES_CPP_NAMESPACE_BEGIN +static XMLAttDefList& getAttDefList(bool isSchemaGrammar + , ComplexTypeInfo* currType + , XMLElementDecl* elemDecl); + // --------------------------------------------------------------------------- // IGXMLScanner: Private helper methods // --------------------------------------------------------------------------- @@ -534,9 +538,10 @@ IGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs // Check after all specified attrs are scanned // (1) report error for REQUIRED attrs that are missing (V_TAGc) // (2) add default attrs if missing (FIXED and NOT_FIXED) - XMLAttDefList &attDefList = (fGrammarType == Grammar::SchemaGrammarType && currType) - ? (currType->getAttDefList()) - : (elemDecl->getAttDefList()); + + + XMLAttDefList &attDefList = getAttDefList(fGrammarType == Grammar::SchemaGrammarType, currType, elemDecl); + while (attDefList.hasMoreElements()) { // Get the current att def, for convenience and its def type @@ -2902,4 +2907,14 @@ void IGXMLScanner::normalizeURI(const XMLCh* const systemURI, } } +inline XMLAttDefList& getAttDefList(bool isSchemaGrammar + , ComplexTypeInfo* currType + , XMLElementDecl* elemDecl) +{ + if (isSchemaGrammar && currType) + return currType->getAttDefList(); + else + return elemDecl->getAttDefList(); +} + XERCES_CPP_NAMESPACE_END diff --git a/src/xercesc/internal/SGXMLScanner.cpp b/src/xercesc/internal/SGXMLScanner.cpp index 724e4563fa2c942aca7be9c49564c36b98aa8e93..884054869c0fa92399a763f5ca922991d80e747e 100644 --- a/src/xercesc/internal/SGXMLScanner.cpp +++ b/src/xercesc/internal/SGXMLScanner.cpp @@ -88,6 +88,8 @@ XERCES_CPP_NAMESPACE_BEGIN +static XMLAttDefList& getAttDefList(ComplexTypeInfo* currType, XMLElementDecl* elemDecl); + // --------------------------------------------------------------------------- // SGXMLScanner: Constructors and Destructor // --------------------------------------------------------------------------- @@ -2404,9 +2406,9 @@ SGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs // Check after all specified attrs are scanned // (1) report error for REQUIRED attrs that are missing (V_TAGc) // (2) add default attrs if missing (FIXED and NOT_FIXED) - XMLAttDefList& attDefList = (currType) - ? currType->getAttDefList() - : elemDecl->getAttDefList(); + + XMLAttDefList& attDefList = getAttDefList(currType, elemDecl); + while (attDefList.hasMoreElements()) { // Get the current att def, for convenience and its def type @@ -4300,5 +4302,12 @@ void SGXMLScanner::normalizeURI(const XMLCh* const systemURI, } } +inline XMLAttDefList& getAttDefList(ComplexTypeInfo* currType, XMLElementDecl* elemDecl) +{ + if (currType) + return currType->getAttDefList(); + else + return elemDecl->getAttDefList(); +} XERCES_CPP_NAMESPACE_END