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).
You can use XSLT to accomplish this, as long as a) all of the text you need to output is in elements, b) you only care about text nodes, c) you know the names of all the elements that contain text, and d) it's okay to emit any text in all of those output elements as CDATA. If all of those cases are true, then you could write an identity transform and add this element to it:
See the W3C XSLT recommendation on this subject.