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 Aristotle Pagaltzis other posts by this author
Jun 21 2009 7:38AM messages near this date
view in the new Beta List Site
xpath problem with XML::XPath and LibXML | Re: Re: xpath problem with XML::XPath and LibXML
& XSLT * redicaps@[...].com <redicaps@[...].com>  [2009-06-21 12:50]:
>  Here is the XML::XPath code:
> 
>  my $xml = XML::XPath->new( xml => $string);
>  my $nodeset = $xml->findnodes('//entry');
>  foreach my $node ( $nodeset->get_nodelist){
>  print $node->findvalue('//title'),"\n";
>  }
> 
>  I got
>  friendsEngowo
>  friendsEngowo
>  which are all the title nodes of this xml, it seems like each
>  $node has all the information of this XML. Dose any one knows
>  what the problem is?

XML::XPath is buggy. It shouldn’t produce any output for your
expession.

>  Then I try to use XML::LibXML instead, here is the code
> 
>  my $xml = XML::LibXML->new->parse_string( $string);
>  my @nodeset = $xml->find('//entry');
>  print Dumper @nodeset;
> 
>  I got
>  $VAR1 = bless( [], 'XML::LibXML::NodeList' );
> 
>  which means I got nothing, entry nodes for this xml are not
>  found, so can anybody help me?

This is correct behaviour. Björn told you the solution; see
<http://plasmasturm.org/log/259/>  for some more background and
some example code.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/> 
_______________________________________________
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