'Retaining HTML Markup when using XML .InnerText
I have HTML markup being read from an XmlDocument using InnerText as below. However, once read into the string "content";
string content = Convert.ToString(XmlDoc.DocumentElement.SelectSingleNode("/update/content").InnerText);
The HTML markup is lost.
How can I retain the HTML markup by the time the node content is in the string "content".
Solution 1:[1]
Solution is to use InnerXML as below, instead of InnerText.
string content = Convert.ToString(XmlDoc.DocumentElement.SelectSingleNode("/update/content").InnerXml);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Adam92 |