【发布时间】:2011-04-18 14:51:08
【问题描述】:
我希望从 html 中删除类似的东西
<!--[if gte mso 9]>
...
<![endif]-->
<!--[if gte mso 10]>
...
<![endif]-->
如何在 C# 中使用 HTMLAgilityPack 做到这一点?
我正在使用
static void RemoveTag(HtmlNode node, string tag)
{
var nodeCollection = node.SelectNodes("//"+ tag );
if(nodeCollection!=null)
foreach (HtmlNode nodeTag in nodeCollection)
{
nodeTag.Remove();
}
}
对于普通标签。
【问题讨论】:
-
我什至不确定来自 microsoftword 的 sn-p 是 HtmlNodeType.Comment
标签: c# html-agility-pack