neilg 2004/05/27 09:33:08 Modified: c/src/xercesc/internal DGXMLScanner.cpp IGXMLScanner.cpp SGXMLScanner.cpp Log: Performance fix. Instead of clearing the undeclared attribute maps each time we enter a start tag, assume they are clear and clear them only once it has been determined that the start tag we've just processed actually had attributes. Revision Changes Path 1.47 +8 -3 xml-xerces/c/src/xercesc/internal/DGXMLScanner.cpp Index: DGXMLScanner.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/DGXMLScanner.cpp,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- DGXMLScanner.cpp 25 May 2004 18:09:50 -0000 1.46 +++ DGXMLScanner.cpp 27 May 2004 16:33:07 -0000 1.47 @@ -1241,8 +1241,6 @@ unsigned int attCount = 0; unsigned int curAttListSize = fAttrList->size(); wasAdded = false; - // clear the map used to detect duplicate attributes - fUndeclaredAttrRegistry->removeAll(); fElemCount++; @@ -1590,6 +1588,13 @@ // Make an initial pass through the list and find any xmlns attributes. if (fDoNamespaces && attCount) scanAttrListforNameSpaces(fAttrList, attCount, elemDecl); + + if(attCount) + { + // clean up after ourselves: + // clear the map used to detect duplicate attributes + fUndeclaredAttrRegistry->removeAll(); + } // Now lets get the fAttrList filled in. This involves faulting in any // defaulted and fixed attributes and normalizing the values of any that 1.68 +15 -8 xml-xerces/c/src/xercesc/internal/IGXMLScanner.cpp Index: IGXMLScanner.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/IGXMLScanner.cpp,v retrieving revision 1.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- IGXMLScanner.cpp 27 Apr 2004 19:17:52 -0000 1.67 +++ IGXMLScanner.cpp 27 May 2004 16:33:07 -0000 1.68 @@ -1757,9 +1757,6 @@ unsigned int attCount = 0; unsigned int curAttListSize = fAttrList->size(); wasAdded = false; - // clear the map used to detect duplicate attributes - fUndeclaredAttrRegistry->removeAll(); - fUndeclaredAttrRegistryNS->removeAll(); fElemCount++; @@ -2048,6 +2045,13 @@ } } + if(attCount) + { + // clean up after ourselves: + // clear the map used to detect duplicate attributes + fUndeclaredAttrRegistry->removeAll(); + } + // Ok, so lets get an enumerator for the attributes of this element // and run through them for well formedness and validity checks. But // make sure that we had any attributes before we do it, since the list @@ -2225,10 +2229,6 @@ // Skip any whitespace after the name fReaderMgr.skipPastSpaces(); - // clear the map used to detect duplicate attributes - fUndeclaredAttrRegistry->removeAll(); - fUndeclaredAttrRegistryNS->removeAll(); - // First we have to do the rawest attribute scan. We don't do any // normalization of them at all, since we don't know yet what type they // might be (since we need the element decl in order to do that.) @@ -2841,6 +2841,13 @@ // it goes in with the number of values we got during the raw scan of // explictly provided attrs above. attCount = buildAttList(*fRawAttrList, attCount, elemDecl, *fAttrList); + if(attCount) + { + // clean up after ourselves: + // clear the map used to detect duplicate attributes + fUndeclaredAttrRegistry->removeAll(); + fUndeclaredAttrRegistryNS->removeAll(); + } // activate identity constraints if (fGrammar && 1.82 +8 -4 xml-xerces/c/src/xercesc/internal/SGXMLScanner.cpp Index: SGXMLScanner.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/SGXMLScanner.cpp,v retrieving revision 1.81 retrieving revision 1.82 diff -u -r1.81 -r1.82 --- SGXMLScanner.cpp 25 May 2004 18:09:51 -0000 1.81 +++ SGXMLScanner.cpp 27 May 2004 16:33:07 -0000 1.82 @@ -1693,9 +1693,6 @@ fElemStack.addChild(elemDecl->getElementName(), true); } - // clear the map used to detect duplicate attributes - fUndeclaredAttrRegistryNS->removeAll(); - // PSVI handling: must reset this, even if no attributes... if(getPSVIHandler()) fPSVIAttrList->reset(); @@ -1708,6 +1705,13 @@ // it goes in with the number of values we got during the raw scan of // explictly provided attrs above. attCount = buildAttList(*fRawAttrList, attCount, elemDecl, *fAttrList); + + if(attCount) + { + // clean up after ourselves: + // clear the map used to detect duplicate attributes + fUndeclaredAttrRegistryNS->removeAll(); + } // activate identity constraints if (toCheckIdentityConstraint())
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]