Hi Daniel, the attached xml file and external entity file produce a very strange result when parsed with SAX interface: the events for an expanded entity content appear three times as if there were three occurrences of the entity. The output of testSAX --noent sax-2.xml is also attached as out.txt. Sorry I'm not able to provide a patch. I'm not really familiar with libxml2's internals as I usually use it only by means of XML::LibXML for Perl. Tested on tuesday's CVS, RedHat 7.3. Thanks, -- Petr
<?xml version="1.0" encoding="ISO-8859-2"?> <!DOCTYPE text [ <!ENTITY ent SYSTEM "sax-2.ent"> ]> <text> &ent; </text>
Attachment:
sax-2.ent
Description: Binary data
SAX.setDocumentLocator() SAX.startDocument(encoding(ISO-8859-2)) SAX.internalSubset(text, , ) SAX.entityDecl(ent, 2, (null), sax-2.ent, (null)) SAX.externalSubset(text, , ) SAX.startElement(text) SAX.characters( , 1) SAX.getEntity(ent) SAX.startElement(foo) SAX.endElement(foo) SAX.ignorableWhitespace( , 1) SAX.startElement(bar) SAX.endElement(bar) SAX.ignorableWhitespace( , 1) SAX.startElement(baz) SAX.endElement(baz) SAX.characters( , 1) SAX.startElement(foo) SAX.endElement(foo) SAX.ignorableWhitespace( , 1) SAX.startElement(bar) SAX.endElement(bar) SAX.ignorableWhitespace( , 1) SAX.startElement(baz) SAX.endElement(baz) SAX.characters( , 1) SAX.startElement(foo) SAX.endElement(foo) SAX.characters( , 1) SAX.startElement(bar) SAX.endElement(bar) SAX.characters( , 1) SAX.startElement(baz) SAX.endElement(baz) SAX.characters( , 1) SAX.characters( , 1) SAX.endElement(text) SAX.endDocument()