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
Use
XML::Generator
require XML::Generator; my $xml = XML::Generator->new( ':pretty', escape => 'always,apos' ); print $xml->h1( " &< >non-html plain text< >&" );
require XML::Generator;
my $xml = XML::Generator->new( ':pretty', escape => 'always,apos' );
print $xml->h1( " &< >non-html plain text< >&" );
which will print all content inside the tags escaped (no conflicts with the markup).