Skip Menu |

This queue is for tickets about the XML-Easy-Transform-RationalizeNamespacePrefixes CPAN distribution.

Report information
The Basics
Id: 59271
Status: resolved
Priority: 0/
Queue: XML-Easy-Transform-RationalizeNamespacePrefixes

People
Owner: Nobody in particular
Requestors: ilmari [...] ilmari.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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
Subject: [rt.cpan.org #59271] Fix merging of prefixed namspaces identical to the default namespace
Date: Fri, 17 Sep 2010 18:31:37 +0100
To: bug-XML-Easy-Transform-RationalizeNamespacePrefixes [...] rt.cpan.org
From: Dagfinn Ilmari Mannsåker <ilmari [...] ilmari.org>
--- .../Easy/Transform/RationalizeNamespacePrefixes.pm | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/XML/Easy/Transform/RationalizeNamespacePrefixes.pm b/lib/XML/Easy/Transform/RationalizeNamespacePrefixes.pm index 581bd43..8a5aa19 100644 --- a/lib/XML/Easy/Transform/RationalizeNamespacePrefixes.pm +++ b/lib/XML/Easy/Transform/RationalizeNamespacePrefixes.pm @@ -185,7 +185,7 @@ of this function. # record that this prefix maps to this namespace; $known_prefixes->{ $prefix } = $ns; - unless ($assigned_ns->{ $ns }) { + unless (exists $assigned_ns->{ $ns }) { # find an unused unique prefix in the destination. while (exists $assigned_prefixes->{ $prefix }) { $prefix = $prefix_generator->($prefix); -- 1.7.0.4
Thanks, applied, in 1.22, heading towards the CPAN as I type.