It's not terribly efficient, or easy to read, or anything, but an approach to this appears to be writing..
]]]]><![CDATA[>
It's not terribly efficient, or easy to read, or anything, but an approach to this appears to be writing..
]]]]><![CDATA[>
CDATA is literal content in a sense, but of course there has to be some way to mark the end of a CDATA block and whatever you choose is going to have to be represented in your string somehow.
When I had to deal with XML documents containing CDATAs inside another CDATA block like you seem to have to, I gave up and encoded the whole thing as Base64. The other side then extracts the text and decodes it.
Base64 is handy because it has common support and/or simple algorithms to code and decode ASCII strings into it in many languages, in my case C# and Javascript in an ASP.NET app.
you can just use two cdata tags, the first one contains ]] and the second one contains >