W3C home > Mailing lists > Public > public-qa-dev@w3.org > January 2009

implementation of libxml2 structured errors throws only last parsing error?

From: olivier Thereaux <ot@w3.org>
Date: Wed, 7 Jan 2009 17:03:26 -0500
Message-Id: <4156490C-B4AC-4DE3-B7E3-668099D973B6@w3.org>
To: Petr Pajas <pajas@ufal.mff.cuni.cz>
Cc: "public-qa-dev@w3.org list" <public-qa-dev@w3.org>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 19 August 2010 18:12:49 GMT