|
novice to xml, so i am not sure if i am using a correct xpath expression. i have the following trivial xml and perl script. $node is either undefined or ends up as the root node (see the whole document in debug).
am trying to get "content3" to come out on stdout.
my trivial xml
<?:xml version="1.0" standalone="yes" ?>
<top attr="1">
content1
content2
<inner id="first" day="friday">
content3
</inner>
</top>
my trivial script
use warnings;
use strict;
use lib '/rshome/jaw2/lib/site_perl/5.8.7';
use XML::DOM::Lite qw( Parser XPath :constants );
my $doc = Parser->parseFile( 'sample.xml' );
my $node = $doc->selectSingleNode( '//inner/child::text()' );
my $nodeValue = $node->nodeValue;
print "node value: $nodeValue\n";
exit 0;
message:
Can't call method "evaluate" without a package or object reference at /rshome/jaw2/lib/site_perl/5.8.7/XML/DOM/Lite/XPath.pm line 322.
|