in reply to Re: XML parsing and Lists
in thread XML parsing and Lists
Thanks for responding.I was not aware of XPathContext module in LibXML. I was trying to use XML::XPath directly and got into an infinite loop of installation issues which I could not get past.
I will try using this approach. Basically, I have to create a array of nodes for the path:
$parser = XML::LibXML->new;
$dom = $parser->parse_file($file);
$root = $dom->getDocumentElement;
my $xc = XML::LibXML::XPathContext->new($file);
my @nodes=$xc->findnodes('//Article//Part//Sect//H5[ contains(.,"I
$count = $xc->findvalue('count(//Article//Part//Sect//LI)',$dom);
Am I on the right track? Anything I'm missing?