开发者

How can I extract things from Divs using HTMLAgilityPack?

I'm learning how to use the library for the first time and would like some help.

Consider I have this somewhere in my HTMLDocument:

<h1>Casablanca
<span>(<a href="/year/2010/">2010</a>) <span class="pro-link"><a href="http://pro.imdb.com/rg/maindetails-title/tconst-pro-header-link/title/tt1226229/">More at <strong>IMDbPro</strong></a>&nbsp;»</span><span class="title-extra"></span></span>
</h1>
开发者_StackOverflow

How can I extract just the Casablanca text, not the span div?

Also, am I correct in thinking that the HtmlNode.InnerText is the text inside of a Div?


Well, there will be a TextNode as the first child of the H1 node.

YourH1Node.FirstChild.InnerText or something similar...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜