Subject: | $node->line_number stops incrementing at 65535 |
Date: | Tue, 22 Jan 2008 11:07:50 +0000 |
To: | bug-XML-LibXML [...] rt.cpan.org |
From: | "Edmund von der Burg" <evdb [...] ecclestoad.co.uk> |
Hello,
I'm using XML::LibXML to handle very large XML files - up to 700,000
lines. When trying to report the line numbers that errors occur at I'm
finding that the line numbers max out at 65535.
This code shows the problem for me.
use strict;
use warnings;
use XML::LibXML;
use Test::More 'no_plan';
diag "XML::LibXML::VERSION: $XML::LibXML::VERSION";
my $xml = "<?xml version=\"1.0\"?>\n";
$xml .= "<outer>\n";
$xml .= " <inner_$_>$_</inner_$_>\n" for 3 .. 100_000;
$xml .= "</outer>\n";
my $parser = XML::LibXML->new;
$parser->line_numbers(1);
my $doc = $parser->parse_string($xml);
foreach my $line ( 10, 1000, 65534, 65535, 65536, 100_000 ) {
my ($node) = $doc->findnodes(".//inner_$line");
is $node->line_number, $line, "checking line number $line";
}
Which gives me the following output:
# XML::LibXML::VERSION: 1.65
ok 1 - checking line number 10
ok 2 - checking line number 1000
ok 3 - checking line number 65534
ok 4 - checking line number 65535
not ok 5 - checking line number 65536
# Failed test 'checking line number 65536'
# in lib-xml-line-number-glitch.pl at line 19.
# got: '65535'
# expected: '65536'
not ok 6 - checking line number 100000
# Failed test 'checking line number 100000'
# in lib-xml-line-number-glitch.pl at line 19.
# got: '65535'
# expected: '100000'
1..6
# Looks like you failed 2 tests of 6.
Please let me know if there is anything else I can do to help fix this glitch.
Cheers,
Edmund.
--
In reality I'm evdb@ecclestoad.co.uk - http://ecclestoad.co.uk
Drive in the UK? - sign this: http://petitions.pm.gov.uk/displaythespeed/