Better logging when skipping tests.
[irspy-moved-to-github.git] / bin / irspy-xpath.pl
1 #!/usr/bin/perl
2
3 # Execute a specific XPath against provided XML, having established
4 # prefixes for the namespaces used in IRSpy.
5
6 use ZOOM::IRSpy::Utils qw(irspy_xpath_context);
7
8 use strict;
9 use warnings;
10
11 my $xpath = shift();
12 my $xml = join("", <>);
13 my $xc = irspy_xpath_context($xml)
14     or die "$0: can't make XPath context";
15 my @nodes = $xc->findnodes($xpath);
16 print scalar(@nodes), " hits\n";
17 print join("", map { $_->to_literal() . "\n" } @nodes);