I want to get player lists from here:
http://www.basketball-reference.com/boxscores/201105090BOS.html
To do that for the first table, I use the following:
HtmlNode reboundsNode = doc.DocumentNode.SelectSingleNode("//table[@class='sortable stats_table']/tbody[1]");
foreach(HtmlNode node in reboundsNode.SelectNodes("tr"))
{
// Get the 'td's.
}
I had to split it into two lines, because "//table[@class='sortable stats_table']/tbody[1]/tr" selected trs from all of the table bodies instead of just the first one. Does anyone know why?
I also have problems when getting the data from the second table (actually table number 3 in the source since there are tables 2 and 4 that are invisible in the default view). When I select "//table[@class='sortable stats_table']", it shows that there are four tables, but when I do "//table[@class='sortable stats_table'][3]", it finds nothing (I get an unbound object exception when I try to use the result. Why is that?