Re: xpath problem with XML::XPath and LibXML
by Bjoern Hoehrmann other posts by this author
Jun 21 2009 3:56AM messages near this date
view in the new Beta List Site
Re: Re: Re: xpath problem with XML::XPath and LibXML
|
XML DTD validation
& XSLT * redicaps@[...].com wrote:
> <?xml version="1.0" encoding="UTF-8"?>
> <feed xmlns="http://www.w3.org/2005/Atom"
> <entry>
> my $xml = XML::LibXML->new->parse_string( $string);
> my @nodeset = $xml->find('//entry');
> print Dumper @nodeset;
>
> I got
> $VAR1 = bless( [], 'XML::LibXML::NodeList' );
The expression "//entry" selects all elements with the local name
"entry" in no namespace. However, the element you want is an "entry"
element in the namespace "http://www.w3.org/2005/Atom". Use the
module XML::LibXML::XPathContext to declare a prefix for the name-
space and then use "//atom:entry" (or whatever your prefix).
--
Björn Höhrmann · mailto:bjoern@[...].de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
redicaps
Aristotle Pagaltzis
redicaps
Shlomi Fish
Michael Ludwig
redicaps
Grant McLean
Bjoern Hoehrmann
|