XML parsers convert XML to text, which entails decoding entities and processing CDATA tags. That's pretty much the definition of a parser. You must convert the text to XML before writing it to another XML file. What are you using to create the XML document? Maybe
XML::Twig is more up your alley if you're doing small changes.