5 my @checkxpath = ('//item/@name', '//item/@id', '//category/@name');
12 foreach my $key (@{$list}) {
13 if (exists($u{$key})) {
14 print "detect duplicate $xpath $key\n";
23 my $xmlfile = shift(@_);
24 my $xpath = shift(@_);
26 $xmlfile =~ s/([\[\]\*\(\)])/\\$1/g;
28 open(my $rs, "xmllint --xpath \"$xpath\" $xmlfile |") or die "Cannot open $xmlfile:$!";
29 my $result = join('', <$rs>);
32 my @result_array = split(/ +/, $result);
36 if ($#ARGV < 0 || !(-f $ARGV[0])) {
37 print "No such file or directory.\n";
41 foreach my $xpath (@checkxpath) {
42 my @result_array = getlist($ARGV[0], $xpath);
43 uniqcheck($xpath, \@result_array);