ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-xml
perl-xml
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved