GNOME Bugzilla – Bug 734283
wrong error column in structured error when parsing end tag
Last modified: 2014-10-06 10:20:30 UTC
Created attachment 282559 [details] Sample XML file, containing errors at line 3 column 22 and line 4 column 24 libxml2 reports wrong error column numbers (field int2 in xmlError) in structured error handler, after parsing an end tag. Example XML: <?xml version="1.0" encoding="UTF-8"?> <root> <elem>A</elem><elem>&</elem> <elem>A</elem ><elem>&</elem> </root> <!-- 1 2 3 4 5 6 7 8 12345678901234567890123456789012345678901234567890123456789012345678901234567890 --> Expected error locations would be line 3, column 22 and line 4, column 24. The actual location of the error is line 3, column 17 and line 4, column 18: $ ./xmlparse colbug3.xml colbug3.xml:3:17: xmlParseEntityRef: no name colbug3.xml:4:18: xmlParseEntityRef: no name
Created attachment 282560 [details] Simple testcase; parses xml file and reports error via structured error handler $ cc `xml2-config --cflags --libs` -o xmlparse xmlparse.c $ ./xmlparse colbug3.xml colbug3.xml:3:17: xmlParseEntityRef: no name colbug3.xml:4:18: xmlParseEntityRef: no name Expected output is: colbug3.xml:3:22: xmlParseEntityRef: no name colbug3.xml:4:24: xmlParseEntityRef: no name
Created attachment 282562 [details] [review] Suggested fix - count characters in end tag
ACK, this looks fine too, so applied and pushed to git, thanks a lot ! Daniel