简体   繁体   中英

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 is to use InnerXML as below, instead of InnerText.

string content = Convert.ToString(XmlDoc.DocumentElement.SelectSingleNode("/update/content").InnerXml);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM