Skip Menu |
 

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

Report information
The Basics
Id: 80273
Status: new
Priority: 0/
Queue: XML-Generator

People
Owner: Nobody in particular
Requestors: m3047 [...] m3047.net
Cc:
AdminCc:

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



Subject: v1.04 incorrectly escaping stringified inner tags
Date: Thu, 18 Oct 2012 17:42:17 -0700 (GMT+7)
To: bug-XML-Generator [...] rt.cpan.org
From: Fred Morris <m3047 [...] m3047.net>
Download (untitled) / with headers
text/plain 2.5k
There seems to be some undesirable interaction between conformance => 'strict' and the invalid character filtering in v1.04 as it pertains to stringified inner tag data: fred.morris@portal:~$ perl -we 'use strict; use XML::Generator; my $XML = XML::Generator->new(conformance => "strict"); printf "%s\n", $XML->record(join "\n", map { my ($k, $v) = @{$_}; $XML->$k($v); } ([threat => 1], [desc => "godzilla"], [value => "http://y.ahoooooooooo.it/0weifjwef"], [detected => "2012-10-16 00:00:00"]));' <record>&lt;threat>1&lt;/threat> &lt;desc>godzilla&lt;/desc> &lt;value>http://y.ahoooooooooo.it/0weifjwef&lt;/value> &lt;detected>2012-10-16 00:00:00&lt;/detected></record> As you can see, only the "<" is escaped which seems odd. If we eliminate the conformance flag, the output looks correct: fred.morris@portal:~$ perl -we 'use strict; use XML::Generator; my $XML = XML::Generator->new(); printf "%s\n", $XML->record(join "\n", map { my ($k, $v) = @{$_}; $XML->$k($v); } ([threat => 1], [desc => "gozdilla"], [value => "http://y.ahoooooooooo.it/0weifjwef"], [detected => "2012-10-16 00:00:00"]));' <record><threat>1</threat> <desc>godzilla</desc> <value>http://y.ahoooooooooo.it/0weifjwef</value> <detected>2012-10-16 00:00:00</detected></record> Likewise, if we disable the "invalid" character filtering the output looks correct: fred.morris@portal:~$ perl -we 'use strict; use XML::Generator; my $XML = XML::Generator->new(conformance => "strict", filter_invalid_chars => 0); printf "%s\n", $XML->record(join "\n", map { my ($k, $v) = @{$_}; $XML->$k($v); } ([threat => 1], [desc => "godzilla"], [value => "http://y.ahoooooooooo.it/0weifjwef"], [detected => "2012-10-16 00:00:00"]));' <record><threat>1</threat> <desc>godzilla</desc> <value>http://y.ahoooooooooo.it/0weifjwef</value> <detected>2012-10-16 00:00:00</detected></record> Furthermore if we stop stringifying the inner tags and let it consume its own spawn, all is well: fred.morris@portal:~$ perl -we 'use strict; use XML::Generator; my $XML = XML::Generator->new(conformance => "strict", pretty => 1); printf "%s\n", $XML->record(map { my ($k, $v) = @{$_}; $XML->$k($v); } ([threat => 1], [desc => "godzilla"], [value => "http://y.ahoooooooooo.it/0weifjwef"], [detected => "2012-10-16 00:00:00"]));' <record> <threat>1</threat> <desc>godzilla</desc> <value>http://y.ahoooooooooo.it/0weifjwef</value> <detected>2012-10-16 00:00:00</detected> </record> This is Linux with Perl 5.10. Version 1.03 does not exhibit this behavior. I thought I'd file this to at least highlight the work-arounds. -- Fred Morris m3047 [at] m3047.net


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.