【发布时间】:2020-01-07 16:56:22
【问题描述】:
我有一个表格,我需要检查两个单元格(位置 9 和 16)是否为 nbsp。我已经成功地计算了位置 9 为空白的出现次数,如下所示:
foreach (HtmlNode results in htmlReport.DocumentNode.SelectNodes("//table[@id='tbl1']"))
{
countMissingElement = results.SelectNodes("//tr//td[position() = 9 and . = ' ']").Count;
}
我尝试了类似于以下语句的各种迭代,但无法使其正常工作。
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;
有什么想法吗?
【问题讨论】:
标签: c# xpath html-agility-pack