Re: bug in XML::LibXML::Error 1.69_1: "int1, int2, int3" becomes "num1, num2, num3"

On čt 5. února 2009, olivier Thereaux wrote:
> Hi Petr,
>
Olivier,

> Playing with the libxml2 structured API today, thanks to your
> recent developer release 1.69_1 of XML::LibXML::Error, I noticed
> a discrepancy in your code: int1() int2() and int3() were
> actually implemented as num1() num2() num3().
>
>
> * http://xmlsoft.org/html/libxml-xmlerror.html mentions int1,
> int2, int3
>
> http://search.cpan.org/~pajas/XML-LibXML-1.69_1/lib/XML/LibXML/Er
>ror.pod too mentions int1, int2, int3
> *
> http://cpansearch.perl.org/src/PAJAS/XML-LibXML-1.69_1/lib/XML/Li
>bXML/Error.pm uses 	num1 => $xE->num1(), etc.
> and a dump of the object shows usage of num1, num2... etc
>
> $error = bless( { 'num1' => 0, 'file' => '', 'message' =>
> 'attributes construct error ', 'domain' => 1, 'level' => 3,
> 'str2' => undef, '_prev' => undef, 'str1' => undef, 'str3' =>
> undef, 'num2' => 10, 'code' => 65, 'line' => 8 },
> 'XML::LibXML::Error' );
>
> I think this may be a mistake. Could you confirm?



the num1, num2 are some mistake, the reason for renaming was 
probably that Perl does not have ints (in the C sense), but I don't 
rememer, the original code is about 5 years old. To avoid breaking 
existing code, I'll fix the documentation to mention only num1 and 
num2, but I'll also make int1() and int2() aliases to num1() and 
num2(). Fixed in SVN.


> A suggested addition to the POD documentation: according to
> http://xmlsoft.org/html/libxml-xmlerror.html the int2 ariable is
> supposed to be the column where the error was found. Knowing that
> is very useful.

added, thanks.

> However, in the case of the error I just dumped above, I am
> surprised that int2/num2 seems to actually be wrong. Indeed,
> 'num2' => 10 where the "old" version of lbxml2 shows the error
> around column 15. Is that a bug too?

Hm, I'll have to investigate this. XML::LibXML just copies what it 
gets from libxml2. But strangely xmllint indeed reports error near 
column 15. 

>
> My test case is
> http://qa-dev.w3.org/wmvs/HEAD/dev/tests/2689-attribute-no-space.
>xhtml feel free to use it, of course.

thanks,

-- Petr

Received on Friday, 6 February 2009 13:34:29 UTC