Skip to content Skip to sidebar Skip to footer

How Do I Add Cdata To An Xml File?

I have an existing xml file that holds notifications I want to display on my site. A snippet follows:

Solution 1:

Try using

newElement.AppendChild(doc.CreateCDataSection(s));

instead of

newElement.InnerXml = "<![CDATA[ " + s + " ]]>";

Solution 2:

Try this way:

newElement.InnerXml = "<![CDATA[ " + s + " ]]>";

Post a Comment for "How Do I Add Cdata To An Xml File?"