Writing Xml with CData sections inside A CData section of an Xml

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
The title might be confusing. But Here are the details.

I have to Prepare an Xml using XmlWriter with some Raw data, example below
<pre class="prettyprint <Message>
<Type>ProcessA</Type>
<Data>
<![CDATA[ Some data ]]>
</Data>
</Message>[/code]
<br/>
Now here is the bummer, sometimes I have to set the following inside the CDATA section
<pre class="prettyprint <ProcessBData>
<Chunk1> <![CDATA[test data]]></Chunk1>
<Chunk2> <![CDATA[test num]]></Chunk2>
</ProcessBData>[/code]
<br/>
So when I call WriteCDataElement() with above Xml as text, it fails.
How to I get around this ? <hr class="sig Fahad

View the full article
 
Back
Top