This is seen with 2.6.3 and CVS head. Attached is a program cdata_bug.c that uses the SAX2 API to parse a file and two files a.xml (with a CDATA section) and b.xml (without). Both files contain a bad entity on line 8, but only the b.xml line counting is correct. Compiling against current libxml2 CVS head: $ xml2-config --version 2.6.3 $ gcc -Wall -g `xml2-config --cflags` cdata_bug.c `xml2-config --libs` -o cdata_bug $ ./cdata_bug a.xml line 6 column 25 error - xmlParseEntityRef: expecting ';' $ ./cdata_bug b.xml line 8 column 25 error - xmlParseEntityRef: expecting ';' This also fails with other SAX APIs such as in 2.5.x, 2.4.x - I tried the last two of these series. I had an attempt at tracing this down inside libxml2 sources but failed :( Dave
<?xml version="1.0" encoding="iso-8859-1"?> <ex:root xmlns:ex="http://example.org/ns#"> <ex:foo><![CDATA[ <p> html stuff </p>]]></ex:foo> <ex:bar> <!-- this is line 8 --> blah blah A&B </ex:bar> </ex:root>
<?xml version="1.0" encoding="iso-8859-1"?> <ex:root xmlns:ex="http://example.org/ns#"> <ex:foo> html stuff </ex:foo> <ex:bar> <!-- this is line 8 --> blah blah A&B </ex:bar> </ex:root>
Attachment:
cdata_bug.c
Description: Binary data