i am trying to get information out of an html table by parsing the html using HtmlAgilityPack.
here is what the HTML looks like:
...
...
...
<tbody>
<tr>
<td class="style_19" style="vertical-align: baseline;">
<div class="style_18">AA00857</div>
</td>
<td class="style_19" style="vertical-align: baseline;">
<div></div>
<div class="style_20">TPRCF</div>
</td>
<td class="style_19" style="vertical-align: baseline;">
<div class="style_21"></div>
</td>
<td class="style_19" style="vertical-align: baseline;">
<div class="style_21">16908/2</div>
</td>
<td class="style_19" style="vertical-align: baseline;">
<div class="style_18"> ETG_C</div>
</td>
</tr>
<tr>
<td class="style_19" style="vertical-align: baseline;">
<div class="style_18">AA01231</div>
</td>
<td class="style_19" style="vertical-align: baseline;">
<div></div>
<div class="style_20">TPRCF</div>
</td>
<td class="style_19" style="vertical-align: baseline;">
<div class="style_21"></div>
</td>
<td class="style_19" style="vertical-align: baseline;">
<div class="style_21">16909/19</div>
</td>
<td class="style_19" style="vertical-align: baseline;">
<div class="style_18"> ETG_C</div>
</td>
</tr>
<tr>
<td class="style_19" style="vertical-align: baseline;">
<div class="style_18">AA01233</div>
</td>
<td class="style_19" style="vertical-align: baseline;">
<div></div>
<div class="style_20">TPRCF</div>
</td>
<td class="style_19" style="vertical-align: baseline;">
<div class="style_21"></div>
</td>
<td class="style_19" style="vertical-align: baseline;">
<div class="style_21">16907/7</div>
</td>
<td class="style_19" style="vertical-align: baseline;">
<div class="style_18"> ETG_C</div>
</td>
</tr>
...
...
i need to extract from the above these values:
AA00857, TPRCF, 16908/2, ETG_C
so far all i have is this:
HtmlWeb hw = new HtmlWeb();
HtmlAgilityPack.HtmlDocument htmlDoc = hw.Load(@"http://www.some123123site.com/index");
if (htmlDoc.DocumentNode != null)
{
HtmlAgilityPack.HtmlNode bodyNode = htmlDoc.DocumentNode.SelectSingleNode("//tbody");
if (bodyNode != null)
{
// Do something with bodyNode
}
}
please help!
Try this: