I am trying to extract a table from a webpage using Html Agility Pack. So far I have managed to do a little of progress with it. This is my code so far
Dim web As New HtmlAgilityPack.HtmlWeb() Dim htmlDoc As HtmlAgilityPack.HtmlDocument = web.Load("--Website url--") Dim html As String = htmlDoc.DocumentNode.OuterHtml Dim tabletag = htmlDoc.DocumentNode.SelectNodes("//table")
Basically I need to find a table with the following html tag
<table width="100%" border="0" cellspacing="0" cellpadding="3" summary="Contains search results">
Any Idea how I can strip down my search for tables to that specific table ?
You need to determine what it is about the table that makes it unique among all the tables in the document. It may be one of those attributes of the table, such as the
summary attribute that makes it unique. Or, it may be one of its child elements inside the table that you need to look for. Since you didn't specify, I'll show an example of how to limit the results based on the
Dim tabletag = htmlDoc.DocumentNode.SelectNodes("//table[@summary='Contains search results']")