我有一个 xml 文件,我使用 LINQ to XML 从中提取 html。这是文件的示例:
<?xml version="1.0" encoding="utf-8" ?>
<tips>
<tip id="0">
This is the first tip.
</tip>
<tip id="1">
Use <b>Windows Live Writer</b> or <b>Microsoft Word 2007</b> to create and publish content.
</tip>
<tip id="2">
Enter a <b>url</b> into the box to automatically screenshot and index useful webpages.
</tip>
<tip id="3">
Invite your <b>colleagues</b> to the site by entering their email addresses. You can then share the content with them!
</tip>
</tips>
我正在使用以下查询从文件中提取“提示”:
Tip tip = (from t in tipsXml.Descendants("tip")
where t.Attribute("id").Value == nextTipId.ToString()
select new Tip()
{
TipText= t.Value,
TipId = nextTipId
}).First();
我遇到的问题是 Html 元素被剥离了。我希望使用像 InnerHtml 这样的东西来代替 Value,但这似乎并不存在。
有任何想法吗?
提前谢谢大家,
戴夫