Your key problem is that in the line:
<result xmlns="http://www.test.com/integration/integration">
The xmlns is declaring that everything contained in the result is in that namespace, so there are no, e.g., code_a named elements in the empty namespace, which is what your findnodes call is looking for. They are instead in the http://www.test.com/integration/integration namespace. As choroba notes, you'll have to register that namespace in order to be able to look for elements within it. So you'll need something like:
my $xpc = XML::LibXML::XPathContext->new($doc); $xpc->registerNs('t', 'http://www.test.com/integration/integration'); foreach my $book_node ($xpc->findnodes('/t:books/t:book') ) { say "book name is " .$book_name->findvalue('/t:name'); }
See also XML::LibXML::Node
In reply to Re: XML Parse
by thargas
in thread XML Parse
by tfeitor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |