Default context-set zeerex.
[irspy-moved-to-github.git] / zebra / ezeerex2pqfproperties.pl
1 #! /usr/bin/perl -w
2
3 # $Id: ezeerex2pqfproperties.pl,v 1.2 2006-06-16 15:28:46 mike Exp $
4
5 use strict;
6 use warnings;
7 use XML::LibXML;
8 use XML::LibXML::XPathContext;
9
10 my $text = join("", <>);
11 my $parser = new XML::LibXML();
12 my $doc = $parser->parse_string($text);
13 my $root = $doc->getDocumentElement();
14 my $xc = XML::LibXML::XPathContext->new($root);
15 $xc->registerNs(zeerex => "http://explain.z3950.org/dtd/2.0/");
16 print "root=$root, xc=$xc\n";
17 my(@nodes) = $xc->findnodes('zeerex:serverInfo/zeerex:host');
18 print "found ", scalar(@nodes), " values\n";
19 for (my $i = 0; $i < @nodes; $i++) {
20     my $node = $nodes[$i];
21     print $i+1, ": ", $node->toString();
22 }