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'");
}