From dc38a63af16624cd340710736f87f0af6e3120a1 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 21 Jul 2010 16:29:13 +0100 Subject: [PATCH] New file, irspy-xpath.pl --- bin/irspy-xpath.pl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 bin/irspy-xpath.pl diff --git a/bin/irspy-xpath.pl b/bin/irspy-xpath.pl new file mode 100755 index 0000000..e90a81a --- /dev/null +++ b/bin/irspy-xpath.pl @@ -0,0 +1,17 @@ +#!/usr/bin/perl + +# Execute a specific XPath against provided XML, having established +# prefixes for the namespaces used in IRSpy. + +use ZOOM::IRSpy::Utils qw(irspy_xpath_context); + +use strict; +use warnings; + +my $xpath = shift(); +my $xml = join("", <>); +my $xc = irspy_xpath_context($xml) + or die "$0: can't make XPath context"; +my @nodes = $xc->findnodes($xpath); +print scalar(@nodes), " hits\n"; +print join("", map { $_->to_literal() . "\n" } @nodes); -- 1.7.10.4