Re: xpath problem with XML::XPath and LibXML
Bjoern Hoehrmann <[email protected]>
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <[email protected]> |
* [email protected] 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:[email protected] · 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 [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs