embed one document in another, each with CDATA section
posted 13 years ago
I have an XML document that contains data best stored in a CDATA section. My colleague has written a component that receives my XML documents. When a volume or time threshhold is reached, the component embeds my XML documents as CDATA in an XML document, compresses the XML document as a stream of bytes, and sends the stream via a JMS message to another component. The component that receives the JMS message decompresses the stream and parses the XML document. The parser encounters a fatal error due to embedded CDATA sections. Here's a quote from W3Schools:
A CDATA section cannot contain another CDATA section. If a CDATA section contains the characters "]]>" or "<![CDATA[" you are in deep trouble.
How, then, do we correctly embed one XML document in another? Thanks for your time, Craig