I have a weird requirement where I need to take some xml and re-write it so that the text nodes are wrapped in CDATA (this is for a client that won\'t allow normal escaping).
Taking premade xml and parsing (with an xml parser) it is just going to make the parser choke on the unescaped characters. The only solution I can think of is to make your own tag soup parser to parse it, modify and dump it back to xml.