Anyone know of any Perl module to escape text in an XML document?
I\'m generating XML which will contain text that was entered by the user. I want to correctly handl
After checking out XML::Code as recommended by Krish I found that this can be done using the XML::Code text() function. E.g.,
use XML::Code;
my $text = new XML::Code('=');
$text->set_text(q{> & < " ' "});
print $text->code(); # prints > < & " ' "
Passing '=' creates a text node which when printed doesn't contain tags. Note: this only works for text data. It wont correctly escape attributes.