in reply to Stepping up from XML::Simple to XML::LibXML
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->findnodes('./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.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" }
|
---|