开发者

How can I extract things from Divs using HTMLAgilityPack?

开发者 https://www.devze.com 2023-01-02 23:26 出处:网络
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:

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

精彩评论

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