Subject: | using xpath on nodes with a default namespace fails |
I'm having trouble getting xpath expressions to work against xml with a default namespace. I'm running the latest non-developer release of XML::LibXML and libxml2-2.6.16 from Gentoo's portage. I spoke with Nacho about this and he agree's it's a bug.
I wrote a test showing the problem I'm having.
#!/usr/bin/perl
use strict;
use XML::LibXML;
use Test::More qw(no_plan);
my $parser = new XML::LibXML;
my $xml = <<'';
<?xml version="1.0"?>
<foo>bar</foo>
my $xmlns = <<'';
<?xml version="1.0"?>
<foo xmlns="http://foo.com">bar</foo>
my $dom = $parser->parse_string($xml);
my $domns = $parser->parse_string($xmlns);
is($dom->findvalue('/foo'), 'bar', 'Foo is Bar');
is($domns->findvalue('/foo'), 'bar', 'Foo is Bar'); # findvalue() is undef