0

作成したPerlファイルを実行しようとしています。

use XML::XPath;
use XML::XPath::XMLParser;

# create an object to parse the file and field XPath queries
my $xpath = XML::XPath->new( filename => shift @ARGV );

# apply the path from the command line and get back a list matches
my $nodeset = $xpath->find( shift @ARGV );

# print each node in the list
foreach my $node ( $nodeset->get_nodelist ) {
  print XML::XPath::XMLParser::as_string( $node ) . "\n";
}

実行するperl xmlfile.plと、このエラーが発生します

"No path to find at /usr/lib/per5/site_perl/5.8.8/XML/XPath.pm line 65"
4

2 に答える 2

0

それは期待しています

perl xmlfile.pl file.xml /some/xpath
于 2012-06-25T17:18:09.537 に答える
0

プログラムは、コマンドライン引数、最初にファイル名、次にXPath式を想定しています。@ARGVヒントです。試す:

perl xmlfile.pl ex07_xpathdata.xml '//item'
于 2012-06-25T17:18:29.287 に答える