Skip Menu |

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

Report information
The Basics
Id: 5223
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: Should not warn on 'xml-stylsheet' PIs
XML::Writer's logic for warning on illegal processing instructions forbids xml-stylesheet, as well as strings with 'xml' other than at the beginning. use XML::Writer; my $w = new XML::Writer(NAMESPACES => 1); $w->pi('xml-stylesheet', "type='text/xsl' href='style.xsl'"); $w->pi('not-reserved-by-xml-spec'); $w->emptyTag('x'); $w->end(); Result: Processing instruction target begins with 'xml' at xml-writer-stylesheet-demo.pl line 7 <?xml-stylesheet type='text/xsl' href='style.xsl'?> Processing instruction target begins with 'xml' at xml-writer-stylesheet-demo.pl line 8 <?not-reserved-by-xml-spec?> <x /> Expected: <?xml-stylesheet type='text/xsl' href='style.xsl'?> <?not-reserved-by-xml-spec?> <x /> The patch attached fixes this.
--- XML/Writer.pm 5 Feb 2004 08:55:45 -0000 1.3 +++ XML/Writer.pm 5 Feb 2004 21:37:30 -0000 1.6 @@ -143,7 +143,7 @@ my $SAFE_pi = sub { my ($name, $data) = (@_); $seen{ANYTHING} = 1; - if ($name =~ /xml/i) { + if (($name =~ /^xml/i) && (lc($name) ne 'xml-stylesheet')) { carp("Processing instruction target begins with 'xml'"); }
Subject: Should not warn on 'xml-stylesheet' PIs
From: bugs [...] kafsemo.org
[guest - Thu Feb 5 16:48:11 2004]: Actually, that second example tickles two bugs. Split out into two tests: $w->pi('xml-stylesheet', "type='text/xsl' href='style.xsl'"); $w->pi('not-reserved-by-xml-spec', ''); $w->pi('pi-with-no-data'); Result: Processing instruction target begins with 'xml' at xml-writer-stylesheet-demo.pl line 7 <?xml-stylesheet type='text/xsl' href='style.xsl'?> Processing instruction target begins with 'xml' at xml-writer-stylesheet-demo.pl line 8 <?not-reserved-by-xml-spec?> Use of uninitialized value in pattern match (m//) at /usr/share/perl5/XML/Writer.pm line 150. <?pi-with-no-data?> <x /> Expected: <?xml-stylesheet type='text/xsl' href='style.xsl'?> <?not-reserved-by-xml-spec?> <?pi-with-no-data?> <x /> Show quoted text
> The patch attached fixes this.
Also, change: - if ($name =~ /\?\>/ || $data =~ /\?\>/) { + if ($name =~ /\?\>/ || (defined($data) && $data =~ /\?\>/)) {