I’m trying to parse information from a div that has 3 tables within it. I can get information from the first one without problem.
Code so far as follow:
HtmlAgilityPack.HtmlWeb doc = new HtmlAgilityPack.HtmlWeb();
HtmlAgilityPack.HtmlDocument htmldocObject = doc.Load(URL);
var res = htmldocObject.DocumentNode.SelectSingleNode("//div[@class='BoxContent']");
var firstTable = res.SelectSingleNode("//table");
var charName = firstTable.ChildNodes[i++].InnerText.Substring(5).Trim();
<div class="BoxContent">
<table>
<tr bgcolor=#505050>
<td colspan=2 class=white>
<b>I'm getting this text</b>
</td>
</tr>
<tr bgcolor=#F1E0C6>
<td>I get this too</td>
<td>I'm getting this as well</td>
</tr>
</table>
<table>
<tr>
<td>Trying to retrieve this</td>
</tr>
</table>
</div>
How can I find the second table information with HAP?
I’ve read some about nextsibling function but I can’t get it to work.
1 Answer