knoaman 2004/10/19 08:08:54 Modified: c/src/xercesc/validators/DTD DTDValidator.cpp c/src/xercesc/internal IGXMLScanner.cpp IGXMLScanner2.cpp SGXMLScanner.cpp c/src/xercesc/util QName.cpp Log: Performance improvement Revision Changes Path 1.25 +3 -45 xml-xerces/c/src/xercesc/validators/DTD/DTDValidator.cpp Index: DTDValidator.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/DTD/DTDValidator.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- DTDValidator.cpp 8 Sep 2004 13:56:50 -0000 1.24 +++ DTDValidator.cpp 19 Oct 2004 15:08:53 -0000 1.25 @@ -101,50 +101,7 @@ void DTDValidator::faultInAttr(XMLAttr& toFill, const XMLAttDef& attDef) const { - // - // At this level, we cannot set the URI id. So we just set it to zero - // and leave it at that. The scanner, who called us, will look at the - // prefix we stored (if any), resolve it, and store the URL id if any. - // - const XMLCh* fullName = attDef.getFullName(); - const int colonInd = XMLString::indexOf(fullName, chColon); - if (colonInd == -1) - { - // There is no prefix, so we just do a simple and quick setting - toFill.set - ( - 0 - , fullName - , XMLUni::fgZeroLenString - , attDef.getValue() - , attDef.getType() - ); - } - else - { - // - // There is a colon, so we have to split apart the name and prefix - // part. - // - XMLCh* tmpNameBuf = XMLString::replicate(fullName, getScanner()->getMemoryManager()); - ArrayJanitor<XMLCh> janNameBuf(tmpNameBuf, getScanner()->getMemoryManager()); - - // Put a null where the colon is, to split it into two strings - tmpNameBuf[colonInd] = chNull; - - // - // And now we can set the attribute object with the prefix and name - // parts. - // - toFill.set - ( - 0 - , &tmpNameBuf[colonInd+1] - , tmpNameBuf - , attDef.getValue() - , attDef.getType() - ); - } + toFill.set(0, attDef.getFullName(), attDef.getValue(), attDef.getType()); } void DTDValidator::reset() @@ -433,6 +390,7 @@ // We also check all of the attributes as well. // NameIdPoolEnumerator<DTDElementDecl> elemEnum = fDTDGrammar->getElemEnumerator(); + fDTDGrammar->setValidated(true); while (elemEnum.hasMoreElements()) { const DTDElementDecl& curElem = elemEnum.nextElement(); 1.77 +1 -5 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.76 retrieving revision 1.77 diff -u -r1.76 -r1.77 --- IGXMLScanner.cpp 13 Oct 2004 18:01:32 -0000 1.76 +++ IGXMLScanner.cpp 19 Oct 2004 15:08:53 -0000 1.77 @@ -1634,10 +1634,6 @@ fElemStack.addChild(elemDecl->getElementName(), true); } - // Ask the element decl to clear out the 'provided' flag on all of its - // att defs. - elemDecl->resetDefs(); - // Skip any whitespace after the name fReaderMgr.skipPastSpaces(); 1.75 +3 -3 xml-xerces/c/src/xercesc/internal/IGXMLScanner2.cpp Index: IGXMLScanner2.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/IGXMLScanner2.cpp,v retrieving revision 1.74 retrieving revision 1.75 diff -u -r1.74 -r1.75 --- IGXMLScanner2.cpp 29 Sep 2004 19:23:32 -0000 1.74 +++ IGXMLScanner2.cpp 19 Oct 2004 15:08:53 -0000 1.75 @@ -93,8 +93,8 @@ } const bool hasDefs = (currType && fValidate) - ? currType->resetDefs() - : elemDecl->resetDefs(); + ? currType->hasAttDefs() + : elemDecl->hasAttDefs(); // another set of attributes; increment element counter fElemCount++; 1.100 +3 -3 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.99 retrieving revision 1.100 diff -u -r1.99 -r1.100 --- SGXMLScanner.cpp 13 Oct 2004 18:01:32 -0000 1.99 +++ SGXMLScanner.cpp 19 Oct 2004 15:08:53 -0000 1.100 @@ -2096,8 +2096,8 @@ } const bool hasDefs = (currType && fValidate) - ? currType->resetDefs() - : elemDecl->resetDefs(); + ? currType->hasAttDefs() + : elemDecl->hasAttDefs(); fElemCount++; 1.13 +20 -16 xml-xerces/c/src/xercesc/util/QName.cpp Index: QName.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/QName.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- QName.cpp 8 Sep 2004 13:56:22 -0000 1.12 +++ QName.cpp 19 Oct 2004 15:08:53 -0000 1.13 @@ -16,6 +16,9 @@ /* * $Log$ + * Revision 1.13 2004/10/19 15:08:53 knoaman + * Performance improvement + * * Revision 1.12 2004/09/08 13:56:22 peiyongz * Apache License Version 2.0 * @@ -341,34 +344,35 @@ , const unsigned int uriId) { //set the rawName - unsigned int newLen; - - newLen = XMLString::stringLen(rawName); - if (!fRawNameBufSz || (newLen > fRawNameBufSz)) - { - fMemoryManager->deallocate(fRawName); //delete [] fRawName; - fRawNameBufSz = newLen + 8; - fRawName = (XMLCh*) fMemoryManager->allocate - ( - (fRawNameBufSz + 1) * sizeof(XMLCh) - ); //new XMLCh[fRawNameBufSz + 1]; - } - XMLString::moveChars(fRawName, rawName, newLen + 1); - + unsigned int newLen = XMLString::stringLen(rawName); //find out the prefix and localPart from the rawName const int colonInd = XMLString::indexOf(rawName, chColon); + if (colonInd >= 0) { + if (!fRawNameBufSz || (newLen > fRawNameBufSz)) + { + fMemoryManager->deallocate(fRawName); //delete [] fRawName; + fRawNameBufSz = newLen + 8; + fRawName = (XMLCh*) fMemoryManager->allocate + ( + (fRawNameBufSz + 1) * sizeof(XMLCh) + ); //new XMLCh[fRawNameBufSz + 1]; + } + XMLString::moveChars(fRawName, rawName, newLen + 1); setNPrefix(rawName, colonInd); } - else + else { // No colon, so we just have a name with no prefix setPrefix(XMLUni::fgZeroLenString); + + // And clean up any QName and leave it undone until/if asked for again + if (fRawName) + *fRawName = 0; } setNLocalPart(&rawName[colonInd+1], newLen-colonInd-1); - // And finally store the URI id parameter fURIId = uriId;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]