【发布时间】:2014-06-28 11:16:55
【问题描述】:
<div id="caption">
<div>
Position: Passenger Side Front
<br></br>
Color: Black
<br></br>
Finish: Smooth / Paintable
<br></br>
Part Brand: LatchWell
<br></br>
Lifetime Warranty
</div>
我需要 xpath 来获取 Part Brand : 值。我想要的 OP 是
LatchWell
这是我的代码:
tag = htmlDoc.DocumentNode.SelectSingleNode("//div[@id='caption']//div");
if (tag != null)
{
wi.Brand = tag.InnerText.Trim();
}
我无法使用拆分函数进行拆分,因为 Part Brand 上方和下方的数据是动态的。
【问题讨论】:
标签: c# xpath web-scraping html-agility-pack