我正在使用 CsQuery 解析一些 wordpress 博客文章,对它们进行一些文本聚类分析。我想从相关<p>
节点中删除文本。
var content = dom["div.entry-content>p"];
if (content.Length == 1)
{
System.Diagnostics.Debug.WriteLine(content[0].InnerHTML);
System.Diagnostics.Debug.WriteLine(content[0].InnerText);
}
在其中一篇文章中,InnerHTML
看起来像这样:
An MIT Europe project that attempts to <a title="Wired News: Gizmo Puts Cards
on the Table" href="http://www.wired.com/news/technology/0,1282,61265,00.html?
tw=rss.TEK">connect two loved ones seperated by distance</a> through the use
of two tables, a bunch of RFID tags and a couple of projectors.
和相应InnerText
的这样
一个 MIT Europe 项目试图通过使用两张桌子、一堆 RFID 标签和几个投影仪。
即内部文本缺少锚文本。我可以自己解析 HTML,但我希望有办法让 CsQuery 给我
一个麻省理工学院欧洲项目,试图通过使用两张桌子、一堆 RFID 标签和几台投影仪来连接两个相距甚远的亲人。
(我的斜体。)我应该怎么得到这个?