I have a table where I need to check if two cells, position 9 and 16, are nbsp. I've had success counting the number of occurrences where position 9 is blank using something like this:
foreach (HtmlNode results in htmlReport.DocumentNode.SelectNodes("//table[@id='tbl1']"))
{
countMissingElement = results.SelectNodes("//tr//td[position() = 9 and . = ' ']").Count;
}
I have tried various iterations of statements similar to the following, but cannot get this to work.
countMissingElement = results.SelectNodes("//tr//td[(position() = 9 and . = ' ') and (position() = 16 and . = ' ')]").Count;
countMissingElement = results.SelectNodes("//tr//td[(position() = 9 and . = ' ')] and //tr//td[(position() = 16 and . = ' ')]").Count;
Any ideas?
You actually want to count rows. Therefore, you should select rows where the 9-th and 16-th child fulfill your requirements:
//tr[td[9]=' ' and td[16]=' ']