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,
From the below link I am trying to return 16 line items found.<br/>

http://www.netcomponents.com/results.htm?t=f&r=1&pn1=12345J
My code so far is below, it keeps returning 0 results..
<pre class="prettyprint" style=" HtmlWeb NC = new HtmlWeb();
HtmlAgilityPack.HtmlDocument doc = NC.Load(NetComsURL.NetComURL);
HtmlNodeCollection NetlinkNodes = doc.DocumentNode.SelectNodes("//div[@ID="livesearch"]");

if (NetlinkNodes != null)
{
// Loop through the nodes in and grab the last one
foreach (var node in NetlinkNodes)
{

txtResult.text += node.InnerText;

}[/code]
Incase you cannot load the link here is the source code....
<pre class="prettyprint <tr><td colspan="2 </td></tr></table></td><TD ALIGN=CENTER VALIGN=MIDDLE NOWRAP WIDTH=100% >&nbsp;<div ID="livesearch" style="display:none;;background: infobackground; 16 line items found.</td> [/code]
<br/>

Many Thanks,
Dean

<br/>

View the full article
 
Back
Top