1 # $Id: Utils.pm,v 1.2 2006-10-30 16:13:49 mike Exp $
3 package ZOOM::IRSpy::Utils;
10 our @EXPORT_OK = qw(xml_encode irspy_xpath_context);
13 # Utility functions follow, exported for use of web UI
15 # I can't -- just can't, can't, can't -- believe that this function
16 # isn't provided by one of the core XML modules. But the evidence all
17 # says that it's not: among other things, XML::Generator and
18 # Template::Plugin both roll their own. So I will do likewise. D'oh!
25 $text =~ s/['']/'/g;
26 $text =~ s/[""]/"/g;
31 sub irspy_xpath_context {
32 my($zoom_record) = @_;
34 my $xml = $zoom_record->render();
35 my $parser = new XML::LibXML();
36 my $doc = $parser->parse_string($xml);
37 my $root = $doc->getDocumentElement();
38 my $xc = XML::LibXML::XPathContext->new($root);
39 $xc->registerNs(e => 'http://explain.z3950.org/dtd/2.0/');
40 $xc->registerNs(i => $ZOOM::IRSpy::irspy_ns);