DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26537>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26537 Bad isEmpty argument for the advanced startElement() event Summary: Bad isEmpty argument for the advanced startElement() event Product: Xerces-C++ Version: 2.4.0 Platform: PC OS/Version: Linux Status: NEW Severity: Normal Priority: Other Component: SAX/SAX2 AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] The SAX2 advanced startElement event should be passed an argument isEmpty=true if the element is empty (like <a/>). But false is passed instead. Another problem is that, for empty elements, the startElement/endElement event pair for the "plain" handler and the startElement for the advanced handler are misaligned. For nonempty elements the ordering of events is plainStart;advancedStart;plainEnd;advancedEnd and for empty elements it's plainStart;plainEnd;advancedStart. This ordering makes it impossible to use the combination advanced startElement / plain endElement. Here's a patch against the Xerces release 2.4 that fixes the two problems: ==== xerces-c-src2_4_0/src/xercesc/internal/IGXMLScanner.cpp#2 (text) ==== 2776c2776 < , false --- > , isEmpty 2911c2911 < if (fDocHandler) --- > if (!isEmpty && fDocHandler) ==== xerces-c-src2_4_0/src/xercesc/internal/WFXMLScanner.cpp#2 (text) ==== 1536c1536 < , false --- > , isEmpty ==== xerces-c-src2_4_0/src/xercesc/parsers/SAX2XMLReaderImpl.cpp#2 (text) ==== 965,967c965,968 < // Bump the element depth counter if not empty < if (!isEmpty) < fElemDepth++; --- > XMLBufBid elemQName( &fStringBuffers ) ; > > // Bump the element depth counter > fElemDepth++; 971d971 < XMLBufBid elemQName( &fStringBuffers ) ; 1042,1071d1041 < < < // If its empty, send the end tag event now < if (isEmpty) < { < // call endPrefixMapping appropriately. < if (getDoNamespaces()) < { < fDocHandler->endElement < ( < fScanner->getURIText(elemURLId) < , elemDecl.getBaseName() < , elemQName.getRawBuffer() < ); < < unsigned int numPrefix = fPrefixCounts->pop(); < for (unsigned int i = 0; i < numPrefix; ++i) < { < XMLBuffer * buf = fPrefixes->pop() ; < fDocHandler->endPrefixMapping( buf->getRawBuffer() ); < fStringBuffers.releaseBuffer(*buf) ; < } < } < else < { < fDocHandler->endElement(XMLUni::fgZeroLenString, < elemDecl.getBaseName(), < elemDecl.getFullName()); < } < } 1090a1061,1089 > > // If its empty, send the end tag event now > if (fDocHandler && isEmpty) > { > // call endPrefixMapping appropriately. > if (getDoNamespaces()) > { > fDocHandler->endElement > ( > fScanner->getURIText(elemURLId) > , elemDecl.getBaseName() > , elemQName.getRawBuffer() > ); > > unsigned int numPrefix = fPrefixCounts->pop(); > for (unsigned int i = 0; i < numPrefix; ++i) > { > XMLBuffer * buf = fPrefixes->pop() ; > fDocHandler->endPrefixMapping( buf->getRawBuffer() ); > fStringBuffers.releaseBuffer(*buf) ; > } > } > else > { > fDocHandler->endElement(XMLUni::fgZeroLenString, > elemDecl.getBaseName(), > elemDecl.getFullName()); > } > } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]