使用XML .innertext时保留HTML标记
我使用innertext从xmldocument读取HTML标记,如下所示。但是,一旦阅读到字符串“内容”中;
string content = Convert.ToString(XmlDoc.DocumentElement.SelectSingleNode("/update/content").InnerText);
HTML标记丢失了。
当节点内容在字符串“ content”中时,我如何保留HTML标记。
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".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案是在下面使用InterxML,而不是Innertext。
Solution is to use InnerXML as below, instead of InnerText.