[ http://nagoya.apache.org/jira/browse/XERCESC-1128?page=history ]
Alberto Massari updated XERCESC-1128: ------------------------------------- Priority: Major > Bad isEmpty argument for the advanced startElement() event > ---------------------------------------------------------- > > Key: XERCESC-1128 > URL: http://nagoya.apache.org/jira/browse/XERCESC-1128 > Project: Xerces-C++ > Type: Bug > Components: SAX/SAX2 > Versions: 2.4.0 > Environment: Operating System: Linux > Platform: PC > Reporter: Jacques Legare > Assignee: Xerces-C Developers Mailing List > > 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()); > > } > > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://nagoya.apache.org/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]