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
|