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 <here!></a>';
# Escaped
my %attrs = (id => '19');
my $xml = tag(\%attrs, $html);
print "$xml\n";
#==> <tag id="19"><a href="hxxp://potatoes.com">Potatoes & co <here!></a></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 <here!></a>]]></tag>
##### OK #####