
Untitled
By: a guest on
Apr 25th, 2012 | syntax:
None | size: 0.70 KB | hits: 16 | expires: Never
How do I add CDATA to an xml file?
<contents>
<item>
<![CDATA[
<a style="font-weight: bold;" href="http://engadget.com">Engadget</a>
]]>
</item>
<item>
<![CDATA[
<a style="font-weight: bold;" href="http://cnn.com">CNN</a>
]]>
</item>
</contents>
foreach (string s in notifications)
{
XmlElement newElement = doc.CreateElement("item");
newElement.InnerXml = "<![CDATA[ " + s + " ]]>";
doc.DocumentElement.SelectNodes("/contents")[0].AppendChild(newElement);
}
newElement.InnerXml = "<![CDATA[ " + s + " ]]>";
newElement.AppendChild(doc.CreateCDataSection(s));
newElement.InnerXml = "<![CDATA[ " + s + " ]]>";