Skip Menu |

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

Report information
The Basics
Id: 23594
Status: resolved
Priority: 0/
Queue: XML-Generator

People
Owner: BHOLZMAN [...] cpan.org
Requestors: mzizka [...] hotmail.com
Cc:
AdminCc:

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



Subject: Embedded escaping does not work as expected
Escaping values that are already escaped does not work as I would expect. For instance, if escaping HTML that already includes entites such as ">", I would expect the resulting escaped value to be ">", but it stays as is. (Hopefully the web site will not ruin my comment, but if that is the case, see comments in attached example.)
Subject: xml_generator_escaping.pl
use XML::Generator escape => 'always', conformance => 'strict', pretty => 2; my $html = '<a href="hxxp://potatoes.com">Potatoes & co &lt;here!&gt;</a>'; # Escaped my %attrs = (id => '19'); my $xml = tag(\%attrs, $html); print "$xml\n"; #==> <tag id="19">&lt;a href="hxxp://potatoes.com"&gt;Potatoes &amp; co &lt;here!&gt;&lt;/a&gt;</tag> ##### Warning: This result is wrong! ##### # CDATA my $xml_cdata = tag(\%attrs, xmlcdata($html)); print "$xml_cdata\n"; #==> <tag id="19"><![CDATA[<a href="hxxp://potatoes.com">Potatoes & co &lt;here!&gt;</a>]]></tag> ##### OK #####
Subject: Re: [rt.cpan.org #23594] Embedded escaping does not work as expected
Date: Fri, 24 Nov 2006 16:46:38 -0500 (EST)
To: bug-XML-Generator [...] rt.cpan.org, undisclosed-recipients [...] null, null [...] null
From: bholzman [...] earthlink.net
How did you construct the XML::Generator object? To get escaping behavior, you have to ask for it: $ perl -MXML::Generator -le 'print XML::Generator->new( )->foo("&gt;")' <foo>&gt;</foo> $ perl -MXML::Generator -le 'print XML::Generator->new(escape => 1)->foo("&gt;")' <foo>&amp;gt;</foo> Benjamin Holzman Show quoted text
-----Original Message-----
>From: "M. Zizka via RT" <bug-XML-Generator@rt.cpan.org> >Sent: Nov 24, 2006 11:39 AM >To: undisclosed-recipients@null, null@null >Subject: [rt.cpan.org #23594] Embedded escaping does not work as expected > > >Fri Nov 24 11:39:27 2006: Request 23594 was acted upon. >Transaction: Ticket created by maz > Queue: XML-Generator > Subject: Embedded escaping does not work as expected > Broken in: 0.99 > Severity: (no value) > Owner: Nobody > Requestors: mzizka@hotmail.com > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=23594 > > > >Escaping values that are already escaped does not work as I would >expect. For instance, if escaping HTML that already includes entites >such as ">", I would expect the resulting escaped value to be >"&gt;", but it stays as is. (Hopefully the web site will not ruin my >comment, but if that is the case, see comments in attached example.)
From: BHOLZMAN [...] cpan.org
On Fri Nov 24 11:39:27 2006, maz wrote: Show quoted text
> Escaping values that are already escaped does not work as I would > expect. For instance, if escaping HTML that already includes entites > such as "&gt;", I would expect the resulting escaped value to be > "&amp;gt;", but it stays as is. (Hopefully the web site will not ruin my > comment, but if that is the case, see comments in attached example.)
Ah, ok, I hadn't seen the attachment. I agree that something is wrong. The difference between escape => 'always' and escape => 1 should not affect things, but it does seem to. Thanks, Benjamin Holzman