CC: | Dagfinn Ilmari Mannsåker <ilmari [...] ilmari.org> |
Subject: | [PATCH] Prefixed namespace not merged with identical default namespace |
Date: | Mon, 12 Jul 2010 11:06:38 +0100 |
To: | bug-XML-Easy-Transform-RationalizeNamespacePrefixes [...] rt.cpan.org |
From: | Dagfinn Ilmari Mannsåker <ilmari [...] ilmari.org> |
If a namespace prefix has the same URI as the default namespace,
it is not recognised as being the same namespace as the default.
---
t/01rnpdoku.t | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/t/01rnpdoku.t b/t/01rnpdoku.t
index 380f3f6..ad7aaf0 100644
--- a/t/01rnpdoku.t
+++ b/t/01rnpdoku.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More tests => 19;
+use Test::More tests => 21;
use Test::XML::Easy;
use XML::Easy::Text qw(xml10_read_document xml10_write_element);
@@ -163,6 +163,26 @@ XML
<doc foo="1" bar="2" />
XML
+is_xml rationalize_namespace_prefixes(xml10_read_document(<<'XML')), <<'XML', { show_xml => 1, ignore_whitespace => 1, description => "non-default namespace repeated" };
+<ns1:a xmlns:ns1="http://example.org/ns/1">
+ <ns2:b xmlns:ns2="http://example.org/ns/1"/>
+</ns1:a>
+XML
+<ns1:a xmlns:ns1="http://example.org/ns/1">
+ <ns1:b/>
+</ns1:a>
+XML
+
+is_xml rationalize_namespace_prefixes(xml10_read_document(<<'XML')), <<'XML', { show_xml => 1, ignore_whitespace => 1, description => "default namespace repeated" };
+<a xmlns="http://example.org/ns/1">
+ <ns:b xmlns:ns="http://example.org/ns/1"/>
+</a>
+XML
+<a xmlns="http://example.org/ns/1">
+ <b/>
+</a>
+XML
+
########################################################################
# error cases
########################################################################
--
1.7.0.4