diff --git a/src/xercesc/internal/IGXMLScanner.cpp b/src/xercesc/internal/IGXMLScanner.cpp index 97254cf7d45eb292d4b57fd05f063bcc3187c00a..138ae7540cdf14c56c12eb89eed48540d489b1be 100644 --- a/src/xercesc/internal/IGXMLScanner.cpp +++ b/src/xercesc/internal/IGXMLScanner.cpp @@ -1634,10 +1634,6 @@ bool IGXMLScanner::scanStartTag(bool& gotData) 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(); diff --git a/src/xercesc/internal/IGXMLScanner2.cpp b/src/xercesc/internal/IGXMLScanner2.cpp index 048d7ffd4cb24dde47a831fb7ef66509d9a710d3..74296dabafd773619a65a437faa6f99879f80507 100644 --- a/src/xercesc/internal/IGXMLScanner2.cpp +++ b/src/xercesc/internal/IGXMLScanner2.cpp @@ -93,8 +93,8 @@ IGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs } const bool hasDefs = (currType && fValidate) - ? currType->resetDefs() - : elemDecl->resetDefs(); + ? currType->hasAttDefs() + : elemDecl->hasAttDefs(); // another set of attributes; increment element counter fElemCount++; diff --git a/src/xercesc/internal/SGXMLScanner.cpp b/src/xercesc/internal/SGXMLScanner.cpp index a5c493e64a3efaa45e00b70c8c26afab9844c9f9..f7bea5c89111f2248ad4aaa6c86fabcf166cd5c1 100644 --- a/src/xercesc/internal/SGXMLScanner.cpp +++ b/src/xercesc/internal/SGXMLScanner.cpp @@ -2096,8 +2096,8 @@ SGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs } const bool hasDefs = (currType && fValidate) - ? currType->resetDefs() - : elemDecl->resetDefs(); + ? currType->hasAttDefs() + : elemDecl->hasAttDefs(); fElemCount++; diff --git a/src/xercesc/util/QName.cpp b/src/xercesc/util/QName.cpp index 27589f1c4ece1ab30a4b603ef21a85cee91004de..3d5f162cda04bf35ed7b4e5b0852a47ba9d4c02a 100644 --- a/src/xercesc/util/QName.cpp +++ b/src/xercesc/util/QName.cpp @@ -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,35 +344,36 @@ void QName::setName(const XMLCh* const rawName , 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; } diff --git a/src/xercesc/validators/DTD/DTDValidator.cpp b/src/xercesc/validators/DTD/DTDValidator.cpp index f3091e2ff8fbca1c464ea84135a8f4e2b6b15c41..92fd65f9ee43eab78a7bcc4dce784735f37e1d43 100644 --- a/src/xercesc/validators/DTD/DTDValidator.cpp +++ b/src/xercesc/validators/DTD/DTDValidator.cpp @@ -101,50 +101,7 @@ int DTDValidator::checkContent(XMLElementDecl* const elemDecl 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 @@ void DTDValidator::preContentValidation(bool reuseGrammar, // 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();