Skip Menu |

This queue is for tickets about the XML-Writer CPAN distribution.

Report information
The Basics
Id: 5222
Status: resolved
Priority: 0/
Queue: XML-Writer

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

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



Subject: XML::Writer should know about the 'xml' prefix.
Generating attributes with the namespace URI 'http://www.w3.org/XML/1998/namespace' results in an unnecessary declaration, and a generated prefix other than 'xml'. use XML::Writer; my $w = new XML::Writer(NAMESPACES => 1); $w->emptyTag('elem', ['http://www.w3.org/XML/1998/namespace', 'space'] => 'preserve'); $w->end(); Results in: <elem __NS1:space="preserve" xmlns:__NS1="http://www.w3.org/XML/1998/namespace" /> Expected: <elem xml:space="preserve" /> The attached patch fixes this behaviour.
diff -u -r1.1 -r1.3 --- Writer.pm 5 Feb 2004 08:42:33 -0000 1.1 +++ Writer.pm 5 Feb 2004 08:55:45 -0000 1.3 @@ -668,6 +668,8 @@ my $defaultPrefix = $prefixMap{''}; delete $prefixMap{''}; + $prefixMap{'http://www.w3.org/XML/1998/namespace'} = 'xml'; + # Generate the reverse map for URIs my %uriMap = (); my $key; @@ -687,7 +689,7 @@ # State variables my $prefixCounter = 1; my @nsDecls = (); - my $nsDecls = {}; + my $nsDecls = {'http://www.w3.org/XML/1998/namespace' => 'xml'}; my @nsDefaultDecl = (); my $nsDefaultDecl = undef; my @nsCopyFlag = ();