Your IP : 216.73.216.1


Current Path : /usr/share/doc/perl-XML-Hash-LX/ex/
Upload File :
Current File : //usr/share/doc/perl-XML-Hash-LX/ex/xpath.pl

#!/usr/bin/perl

use strict;
use lib::abs '../lib';
use XML::LibXML;
use XML::Hash::LX;
use Data::Dumper;

my $xml = do 'xml.pl';

# parse in common way
my $doc = XML::LibXML->new->parse_string($xml);
my $xp  = XML::LibXML::XPathContext->new($doc);
$xp->registerNs('rss', 'http://purl.org/rss/1.0/');

# then process xpath
for ($xp->findnodes('//rss:item')) {
	# and convert to hash concrete nodes
	print Dumper+xml2hash($_);
}