Perl Monk, Perl Meditation | |
PerlMonks |
Re: XML equivalent of HTML::Entities?by mirod (Canon) |
on Jun 19, 2001 at 22:09 UTC ( [id://89762]=note: print w/replies, xml ) | Need Help?? |
It all depends on the result you want. If you want to get HTML entities (é as é, etc.) then it makes sense to use HTML::Entities. If you want to escape only &, <, >, ", and ', then you can use XML::Parser::Expat::xml_escape, but frankly it doesn't make much sense to do that. If you want to escape those characters and also to turn all characters outside of the 0-127 range into XML character entities (i.e. &#nnn;), then you can use the following subroutine, lifted from XML::DOM and not tested with all the possible system/Perl/XML-parser combinations:
In Section
Seekers of Perl Wisdom
|
|