【发布时间】:2016-09-25 13:42:15
【问题描述】:
我正在尝试从“div”中提取文本并排除其他所有内容。你能帮帮我吗?!
<div class="article">
<div class="date">01.01.2000</div>
<div class="news-type"><a href="../link/page01">Breaking News</a></div>
"Here is the location of the text i would like to pull"
</div>
当我提取“文章”类时,我得到了所有内容,但我无法/不知道如何排除 class="date"、class="news-type" 以及其中的所有内容。
这是我使用的代码:
HtmlDocument doc = web.Load(url);
foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//div[contains(@class,'article')]"))
{
name_text.text += node.InnerHtml.Trim();
}
谢谢!
【问题讨论】:
标签: c# html html-agility-pack