We have xml storage format such as
<record> data </record>
We have hit a use case where data itself can be xml. How can xml data be included inside another xml element such as
<record>
We have xml storage format such as
<record> data </record>
We have hit a use case where data itself can be xml. How can xml data be included inside another xml element such as
<record>
It is perfectly valid for an XML element to contain XML like the following:
<record><record>test</record></record>
If this is not what you need, please clarify further in your question. As a last resort you may consider using CData Elements.
<record>
<![CDATA[<someotherbadlyformedxml>data<br></someotherbadlyformedxml>]]>
</record>
But there really should be no reason to do so if all of your data is valid XML.
Two possible solutions:
escape the strings/xml data before you write your record elements.
use CDATA sections