From: Anders S. Mortensen Date: Fri, 13 Oct 2006 13:41:56 +0000 (+0000) Subject: Moving the irspy namespace to the IRSpy package (to keep it in one place). X-Git-Tag: CPAN-v1.02~967 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=6d728caadc58eef3c2b50ac6c190273b0ba11ab5;p=irspy-moved-to-github.git Moving the irspy namespace to the IRSpy package (to keep it in one place). --- diff --git a/lib/ZOOM/IRSpy.pm b/lib/ZOOM/IRSpy.pm index 8320c84..398765a 100644 --- a/lib/ZOOM/IRSpy.pm +++ b/lib/ZOOM/IRSpy.pm @@ -1,4 +1,4 @@ -# $Id: IRSpy.pm,v 1.29 2006-10-12 16:54:13 mike Exp $ +# $Id: IRSpy.pm,v 1.30 2006-10-13 13:41:56 sondberg Exp $ package ZOOM::IRSpy; @@ -15,6 +15,7 @@ use ZOOM::IRSpy::Record; our @ISA = qw(); our $VERSION = '0.02'; +our $irspy_ns = 'http://indexdata.com/irspy/1.0'; # Enumeration for callback functions to return diff --git a/lib/ZOOM/IRSpy/Record.pm b/lib/ZOOM/IRSpy/Record.pm index d782384..c213f54 100644 --- a/lib/ZOOM/IRSpy/Record.pm +++ b/lib/ZOOM/IRSpy/Record.pm @@ -1,4 +1,4 @@ -# $Id: Record.pm,v 1.14 2006-10-12 16:54:13 mike Exp $ +# $Id: Record.pm,v 1.15 2006-10-13 13:41:57 sondberg Exp $ package ZOOM::IRSpy::Record; @@ -90,7 +90,7 @@ sub append_entry { my $root = $this->{zeerex}; # XML::LibXML::Element ISA XML::LibXML::Node my $xc = XML::LibXML::XPathContext->new($root); $xc->registerNs(zeerex => "http://explain.z3950.org/dtd/2.0/"); - $xc->registerNs(irspy => "http://indexdata.com/irspy/1.0"); + $xc->registerNs(irspy => $ZOOM::IRSpy::irspy_ns); my @nodes = $xc->findnodes($xpath); if (@nodes == 0) { @@ -129,7 +129,7 @@ sub append_entry { # namespace mapping for that node -- but that only affects pre-parsed # trees, and is no use for parsing. Hence the following pair of lines # DOES NOT WORK: -# $node->setNamespace("http://indexdata.com/irspy/1.0", "irspy", 0); +# $node->setNamespace($ZOOM::IRSpy::irspy_ns, "irspy", 0); # $node->appendWellBalancedChunk($frag); # # Instead I have to go the long way round, hence this method. I have @@ -143,7 +143,7 @@ sub _half_decent_appendWellBalancedChunk { my($node, $frag) = @_; if (1) { - $frag =~ s,>, xmlns:irspy="http://indexdata.com/irspy/1.0">,; + $frag =~ s,>, xmlns:irspy="$ZOOM::IRSpy::irspy_ns">,; $node->appendWellBalancedChunk($frag); return; }