implementation of libxml2 structured errors throws only last parsing error?

Hi Petr,

my name is Olivier Thereaux and I'm one of the developer of W3C's  
Markup Validator, a perl tool which uses XML::LibXML to check  
documents for XML well-formedness, and indeed, which we're considering  
for RNG/XS validation needs. So first, I need to thank you for  
maintaining and developing this library, it's been a great help for us.

I hope you won't mind me contacting you directly over a small question  
that has been bugging me for the past few weeks.

While testing the latest code of our validator, one of our users  
noticed that the behavior of our xml-well-formedness check was  
behaving differently on some platforms, and I diagnosed that a change  
in libxml2+XML::LibXML was the cause.

Subsequently finding about the recent implementation of libxml2  
structured errors in XML::LibXML (one of my wished come true!) I am  
however hitting a wall.

Indeed, compare the results of parsing the following ill-formed XML  
string:
<foo attr1="value1"attr2="value2" />
Before and After shown here:
-> http://www.w3.org/Bugs/Public/show_bug.cgi?id=6329#c9

Before, with a single string, we would get:
* the sequence of xml parsing errors
* the line where the error occured
* a way to parse "where" on that line the error occured

With the new implementation, we now get:
* only the last parsing error
* no longer any pointer
* no way to know where on the line the error was thrown

What is most problematic here is that I am getting only the last  
parsing error, indeed the least interesting. Getting only the first  
parsing error would be better. Even better of course would be to get  
an array of all those errors.

Is there any way I could get the whole sequence of errors? Am I using  
the library in the wrong way?

Any help or pointer you could provide would be most useful.

Thank you!
olivier
-- 
olivier Thereaux - W3C - http://www.w3.org/People/olivier
W3C Open Source Software : http://www.w3.org/Status

Received on Wednesday, 7 January 2009 22:03:35 UTC