I need to put a rather large xml file into another xml file. I considered using CDATA for this:
http://www.w3.org/TR/2000/REC-xml-20001006#sec-cdata-sect
http://www.w3schools.com/xml/xml_cdata.asp
but since my xml might also contain CDATA this does not work unless I do some nasty workaround:
http://web-design.blogs.webucator.com/2010/11/20/nesting-cdata-blocks/
Are there better ways of transferring/encoding large nested xml files or is the xml format simply not meant to be used in this way?
Yes, in your top-most document make the CDATA section of data type bin.base64. That way even if the document you’re wrapping contains a CDATA section, you’re protected. As an added bonus, your application will also support binary files (images, spreadsheets, etc.).
Here’s some code that does it, based on Microsoft ADO, and MSXML.
And how to un-wrap it on the other end…