How can I strip invalid XML characters from strings in Perl?

Posted by AndrewR on Stack Overflow See other posts from Stack Overflow or by AndrewR
Published on 2009-06-19T08:31:17Z Indexed on 2010/06/11 22:22 UTC
Read the original article Hit count: 164

Filed under:
|

I'm looking for what the standard, approved, and robust way of stripping invalid characters from strings before writing them to an XML file. I'm talking here about blocks of text containing backspace (^H) and formfeed characters etc.

There has to be a standard library/module function for doing this but I can't find it.

I'm using XML::LibXML to build a DOM tree that I then serialize to disk.

© Stack Overflow or respective owner

Related posts about Xml

Related posts about perl