Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 + " ]]>";
Advertisement
Add Comment
Please, Sign In to add comment