【发布时间】:2015-05-04 14:50:27
【问题描述】:
我想在 div 类之间提取文本“Some text goes here”。 我正在使用 html 敏捷包和 c#
<div class="productDescriptionWrapper">
Some Text Goes here...
<div class="emptyClear"> </div>
</div>
这就是我所拥有的:
Description = doc.DocumentNode.SelectNodes("//div[@class=\"productDescriptionWrapper\").Descendants("div").Select(x => x.InnerText).ToList();
我收到此错误:
An unhandled exception of type 'System.NullReferenceException'
如果文本是 b/w <h1> 或 <p> 而不是后代中的“div”,我知道如何提取,我将不得不给出“h1”或“p”。
请有人帮忙。
【问题讨论】:
-
[@class=\"productDescriptionWrapper\"的右括号在哪里? -
可能是我在这里输入时错过了它...它不起作用..
标签: c# html winforms html-agility-pack