This is the exact problem I am trying to solve now (namespace defined at library).
I added:
my $xc = XML::LibXML::XPathContext->new($doc);<br/>
$xc->registerNs('ns', 'xmlapi_1.0');
and changed the foreach to:
foreach my $book ($xc->findnodes('//ns:book')) {
But no matter what I try, I can't get book's attributes.
I know I'm getting the info (print $book->to_literal, "\n";) but how do I access the info individually? | [reply] [Watch: Dir/Any] [d/l] [select] |
| [reply] [Watch: Dir/Any] |
Thanks grantm. Please see me reply to that post. I'm still missing... something!
| [reply] [Watch: Dir/Any] |
It would be really nice if the code was explained in English, line by line. For a newbie Perl writer figuring out what the different items mean is almost impossible.
A guide that explains items would be most helpful. Example what the heck is findnodes what other keywords can be used and how
| [reply] [Watch: Dir/Any] |
XML::LibXML has a fairly extensive documentation. For example findnodes is documented in XML::LibXML::Node, along with many other methods that can be used on any node, since it's the base class for all nodes. The general idea of how the XML document is represented is explained in this tutorial: http://www.w3schools.com/dom/
| [reply] [Watch: Dir/Any] [d/l] [select] |
| [reply] [Watch: Dir/Any] |