neilg 2003/09/22 12:50:02 Modified: c/src/xercesc/validators/schema TraverseSchema.cpp Log: avoid using SchemaGrammar::fElemNonDeclPool; this is not necessary. Revision Changes Path 1.86 +27 -10 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.85 retrieving revision 1.86 diff -u -r1.85 -r1.86 --- TraverseSchema.cpp 13 Aug 2003 22:22:19 -0000 1.85 +++ TraverseSchema.cpp 22 Sep 2003 19:50:02 -0000 1.86 @@ -5064,7 +5064,6 @@ SchemaInfo::ListType infoType = SchemaInfo::INCLUDE; int saveScope = fCurrentScope; unsigned int uriId = fURIStringPool->addOrFind(nameURI); - bool wasAdded = false; if (!XMLString::equals(nameURI, fTargetNSURIString)) { @@ -5075,8 +5074,14 @@ noErrorDetected = false; reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidNSReference, nameURI); - return (SchemaElementDecl*) fSchemaGrammar->findOrAddElemDecl(uriId, localPart, XMLUni::fgZeroLenString, - 0, Grammar::TOP_LEVEL_SCOPE, wasAdded); + SchemaElementDecl *retVal = (SchemaElementDecl*) fSchemaGrammar->getElemDecl(uriId, localPart, + 0, Grammar::TOP_LEVEL_SCOPE); + // in a manner of speaking, we're lying to the grammar here; + // the element really wasn't declared, but we need the decl to act + // as a placeholder, so, in a way, it is declared for us + return (retVal != 0?retVal: + ((SchemaElementDecl*) fSchemaGrammar->putElemDecl(uriId, localPart, XMLUni::fgZeroLenString, + 0, Grammar::TOP_LEVEL_SCOPE))); } Grammar* grammar = fGrammarResolver->getGrammar(nameURI); @@ -5089,8 +5094,14 @@ noErrorDetected = false; reportSchemaError(elem, XMLUni::fgValidityDomain, XMLValid::GrammarNotFound, nameURI); - return (SchemaElementDecl*) fSchemaGrammar->findOrAddElemDecl(uriId, localPart, XMLUni::fgZeroLenString, - 0, Grammar::TOP_LEVEL_SCOPE, wasAdded); + SchemaElementDecl *retVal = (SchemaElementDecl*) fSchemaGrammar->getElemDecl(uriId, localPart, + 0, Grammar::TOP_LEVEL_SCOPE); + // in a manner of speaking, we're lying to the grammar here; + // the element really wasn't declared, but we need the decl to act + // as a placeholder, so, in a way, it is declared for us + return (retVal != 0?retVal: + ((SchemaElementDecl*) fSchemaGrammar->putElemDecl(uriId, localPart, XMLUni::fgZeroLenString, + 0, Grammar::TOP_LEVEL_SCOPE))); } if (!elemDecl) { @@ -5101,8 +5112,11 @@ noErrorDetected = false; reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::TypeNotFound, nameURI, localPart); - return (SchemaElementDecl*) grammar->findOrAddElemDecl(uriId, localPart, XMLUni::fgZeroLenString, - 0, Grammar::TOP_LEVEL_SCOPE, wasAdded); + // in a manner of speaking, we're lying to the grammar here; + // the element really wasn't declared, but we need the decl to act + // as a placeholder, so, in a way, it is declared for us + return ((SchemaElementDecl*) fSchemaGrammar->putElemDecl(uriId, localPart, XMLUni::fgZeroLenString, + 0, Grammar::TOP_LEVEL_SCOPE)); } infoType = SchemaInfo::IMPORT; @@ -5133,8 +5147,11 @@ noErrorDetected = false; reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::TypeNotFound, nameURI, localPart); - elemDecl = (SchemaElementDecl*) fSchemaGrammar->findOrAddElemDecl(uriId, localPart, XMLUni::fgZeroLenString, - 0, Grammar::TOP_LEVEL_SCOPE, wasAdded); + // in a manner of speaking, we're lying to the grammar here; + // the element really wasn't declared, but we need the decl to act + // as a placeholder, so, in a way, it is declared for us + elemDecl = ((SchemaElementDecl*) fSchemaGrammar->putElemDecl(uriId, localPart, XMLUni::fgZeroLenString, + 0, Grammar::TOP_LEVEL_SCOPE)); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]