Subject: | <foo xmlns="..." isn't understood to be in the foo namespace |
The following test shows that the namespace prefix isn't being chosen
correctly. Given a xmlns declaration without a prefix, the effective
prefix is the containing element's name. XML::LibXML pushes the element
out of the xml namespace but doesn't apply the sdnList namespace to it
or its children.
use Test::More tests => 1;
use XML::LibXML ();
{
my $xml = <<'XML';
<?xml version="1.0" standalone="yes"?>
<sdnList xmlns="http://tempuri.org/sdnList.xsd">
<sdnEntry>
<lastName>Hello world!</lastName>
</sdnEntry>
</sdnList>
XML
my $parser = XML::LibXML->new;
my $doc = $parser->parse_string($xml);
my $result = $doc->findvalue('//sdnList:lastName');
is( $result, "Hello world!", "Namespace" );
}