knoaman 2002/10/16 08:10:28 Modified: c/src/xercesc/validators/schema TraverseSchema.cpp Log: [Bug 13293] Schema ID validation can fail depending on declaration ordering. Revision Changes Path 1.29 +12 -14 xml-xerces/c/src/xercesc/validators/schema/TraverseSchema.cpp Index: TraverseSchema.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/TraverseSchema.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- TraverseSchema.cpp 15 Oct 2002 18:23:05 -0000 1.28 +++ TraverseSchema.cpp 16 Oct 2002 15:10:27 -0000 1.29 @@ -2157,8 +2157,6 @@ const XMLCh* name = getElementAttValue(elem, SchemaSymbols::fgATT_NAME); const XMLCh* ref = getElementAttValue(elem, SchemaSymbols::fgATT_REF); - const XMLCh* fixed = getElementAttValue(elem, SchemaSymbols::fgATT_FIXED); - const XMLCh* deflt = getElementAttValue(elem, SchemaSymbols::fgATT_DEFAULT); bool nameEmpty = (!name || !*name) ? true : false; bool refEmpty = (!ref || !*ref) ? true : false; @@ -2172,17 +2170,28 @@ return 0; } + if (topLevel) { + + if (fSchemaGrammar->getElemDecl(fTargetNSURI, name, 0, Grammar::TOP_LEVEL_SCOPE) != 0) { + return new QName(name, fTargetNSURI); + } + } + // ------------------------------------------------------------------ // Check attributes // ------------------------------------------------------------------ unsigned short scope = (topLevel) ? GeneralAttributeCheck::E_ElementGlobal : (refEmpty) ? GeneralAttributeCheck::E_ElementLocal : GeneralAttributeCheck::E_ElementRef; + fAttributeCheck.checkAttributes(elem, scope, this, topLevel); // ------------------------------------------------------------------ // Process contents // ------------------------------------------------------------------ + const XMLCh* fixed = getElementAttValue(elem, SchemaSymbols::fgATT_FIXED); + const XMLCh* deflt = getElementAttValue(elem, SchemaSymbols::fgATT_DEFAULT); + if((fixed && *fixed) && (deflt && *deflt)) { reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::ElementWithFixedAndDefault); } @@ -2218,17 +2227,6 @@ ComplexTypeInfo* subGroupTypeInfo = 0; ContentSpecNode* contentSpecNode = 0; SchemaElementDecl::ModelTypes contentSpecType = SchemaElementDecl::Any; - - if (topLevel) { - - if (!refEmpty) { - reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::GlobalElementWithRef, name); - } - - if (fSchemaGrammar->getElemDecl(fTargetNSURI, name, 0, Grammar::TOP_LEVEL_SCOPE) != 0) { - return new QName(name, fTargetNSURI); - } - } // Create element decl bool isDuplicate = false;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]