I'm using HtmlAgilityPack
and I have the following situation:
<table class='table-main odds '>
<tbody>
<tr>..</tr>
<tr>..</tr>
<tr>..</tr>
<tr></tr>
<tr></tr>
</tbody>
</table>
as you can see only three tr
have content inside, so I want that in the final result should be available only the first three tr
. Actually my code return all the tr
:
HtmlNode oddsTable = doc.DocumentNode
.SelectSingleNode("//table[starts-with(@class, 'table-main')]");
HtmlNodeCollection rows = oddsTable.SelectNodes("tbody//tr");
how can I achieve that using xpath
?
Thanks for any help and explaination.
Depends on what you mean by content:
//tr[node()]
//tr[*]
//tr[text()]
//tr[normalize-space()]