Subject: | getAttributeNS not working on utf-8 encoded xml |
getAttributeNS isn't working on UTF-8 encoded documents, attached is a
patch for t/10ns.t which adds tests that illustrate the bug. This bug
was introduced somewhere between 1.66 and 1.68.
I have been looking over the svn commits between the 2 versions, but
haven't found anything that could cause this yet.
-Daniel
Subject: | libxml.patch |
Index: 10ns.t
===================================================================
--- 10ns.t (revision 755)
+++ 10ns.t (working copy)
@@ -1,6 +1,6 @@
# -*- cperl -*-
use Test;
-BEGIN { plan tests=>124; }
+BEGIN { plan tests=>129; }
use XML::LibXML;
use XML::LibXML::Common qw(:libxml);
@@ -146,6 +146,17 @@
ok ( $root->getAttributeNodeNS('http://example.com','attr') );
ok ( $root->getAttributeNS('http://example.com','attr'), 'value' );
ok ( $root->getAttributeNode('xxx:attr')->getNamespaceURI(), 'http://example.com');
+
+ #change encoding to UTF-8 and retest
+ $doc->setEncoding('UTF-8');
+ # namespaced attributes
+ $root->setAttribute('xxx:attr', 'value');
+ ok ( $root->getAttributeNode('xxx:attr') );
+ ok ( $root->getAttribute('xxx:attr'), 'value' );
+ print $root->toString(1),"\n";
+ ok ( $root->getAttributeNodeNS('http://example.com','attr') );
+ ok ( $root->getAttributeNS('http://example.com','attr'), 'value' );
+ ok ( $root->getAttributeNode('xxx:attr')->getNamespaceURI(), 'http://example.com');
}
print "# 8. changing namespace declarations\n";