我有像这样的xml
XElement xe = "<root>
<mynode>
Text with link <a href=''>Test</a>
</mynode>
</root>";
public static string GetHtmlFromXElement(this XElement xe)
{
return xe.ToString();
}
如果我使用
string result = xe.Element("mynode").GetHtmlFromXElement();
我得到了
<mynode>Text with link <a href=''>Test</a></mynode>
但我需要
Text with link <a href=''>Test</a>
如何做到这一点?
答案 0 :(得分:1)
This看起来大致相同的问题,有一些非常深入的答案。
答案 1 :(得分:0)
尝试
string result = xe.Element("mynode").Value;