Using HTML agility pack to select a node.

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi Guys,Ok I am using html agility pack.I am using the link below as the webpage reference. I was to return the total number of search matches (in this case 31) into my project.
http://www.brokerforum.com/electronic-components-search-en.jsa?originalFullPartNumber=45678&x=77&y=9&hasNoSearchCriteria=false
The html that I need to drill down to is as follows...
<pre class="prettyprint <div class="resultsDescription
Results <span>1-25 for 45678 (of <span>31)
[/code]
My code so far is as follows.....
<pre class="prettyprint HtmlWeb hw = new HtmlWeb();
HtmlAgilityPack.HtmlDocument doc = hw.Load("http://www.brokerforum.com/electronic-components-search-en.jsa?originalFullPartNumber=45678&x=77&y=9&hasNoSearchCriteria=false");
HtmlNode linkNodes = doc.DocumentNode.SelectSingleNode("//div[@class="resultsDescription"]/span");

txtDeleteAfter.Text = linkNodes.ToString();[/code]
Many Thanks,
Dean

<br/>


View the full article
 
Back
Top