Subject: | Namespace_uri () Function updated in Function.pm |
Date: | Wed, 8 Jun 2011 10:59:01 -0400 |
To: | <bug-XML-XPath [...] rt.cpan.org> |
From: | "Tanner, Douglas C CIV SPAWARSYSCEN-ATLANTIC, 58140" <douglas.c.tanner [...] navy.mil> |
Currently in XML::XPath-1.13::Function.pm:
sub namespace_uri {
my $self = shift;
my ($node, @params) = @_;
die "namespace-uri: namespace-uri: Function not supported\n"
}
Proposed change:
sub namespace_uri {
my $self = shift;
my ($node, @params) = @_;
if (@params > 1) {
die "namespace-uri: function takes one or no parameters\n";
}
elsif (@params) {
my $nodeset = shift(@params);
$node = $nodeset->get_node(1);
}
my $namespace = $node->getNamespace->toString; #sets to
xmlns:[name]="namespace" or xmlns="namespace"
$namespace =~ /\"(.*?)\"/; #we only need data between the quotation
marks
return XML::XPath::Literal->new($1);
}
I am by no means a perl or xml expert, so please let me know if you need to
make any changes.
Thanks,
Doug Tanner
843.218.2942
douglas.c.tanner@navy.mil
Message body not shown because it is not plain text.