Skip Menu |

This queue is for tickets about the XML-LibXML-Iterator CPAN distribution.

Report information
The Basics
Id: 6873
Status: resolved
Worked: 1 hour (60 min)
Priority: 0/
Queue: XML-LibXML-Iterator

People
Owner: Nobody in particular
Requestors: subs [...] snackfood.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: next() skips first element
Hi, I'm iterating through a nodelist using an XML::LibXML::NodeList::Iterator object, but next() seems to skip the first element (first() works ok though). Is this the correct behaviour? I've written a simplified testcase below which fails on: libxml2 2.6.9 XML::LibXML 1.58 XML::LibXML::Iterator 1.00 and libxml2 2.5.10 XML::LibXML 1.55 XML::LibXML::Iterator 1.00 Linux ltkdev 2.6.6-1.435.2.3 #1 Thu Jul 1 08:25:29 EDT 2004 i686 i686 i386 GNU/Linux (Fedora) Thanks for your time. Ben ---------------------------------------- #!/usr/bin/perl -w # (perl v5.8.4) use strict; use XML::LibXML; use XML::LibXML::NodeList::Iterator; my $xml = do { local $/; <DATA> }; my $parser = XML::LibXML->new(); my $doc = $parser->parse_string( $xml ); my $root = $doc->getDocumentElement(); my $cards = $root->findnodes("//Card"); my $iter = XML::LibXML::NodeList::Iterator->new( $cards ); print "Expecting: 1 2 3\nGot: "; while (my $card = $iter->next) { print $card->findvalue('CardID'), " "; } print "\n"; __DATA__ <?xml version="1.0"?> <content> <Card> <CardID>1</CardID> </Card> <Card> <CardID>2</CardID> </Card> <Card> <CardID>3</CardID> </Card> </content>
fixed in 1.02