in reply to Stepping up from XML::Simple to XML::LibXML

The version of XML::LibXML that's in RHEL5 (1.58) performs badly when performing findnodes on the results of findnodes for large XML files. The latest version from CPAN performs fine.
use XML::LibXML; my $parser = XML::LibXML->new(); my $doc = $parser->parse_file($filename); foreach my $book ($doc->findnodes('/library/book')) { my($title) = $book->findnodes('./title'); print $title->to_literal, "\n" }
Here is my workaround for RHEL5:
use XML::LibXML; my $parser = XML::LibXML->new(); my $doc = $parser->parse_file($filename); foreach my $book ($doc->findnodes('/library/book')) { my($title) = $book->getChildrenByTagName('title'); print $title->to_literal, "\n" }
Despite $book->childNodes returning only $book's child nodes, $book->findnodes appears to perform findnodes on the entire contents of $doc.