htmlagilitypack只能读取第一行

时间:2015-09-06 18:26:14

标签: c#

我使用htmlagilitypack从html文件中读取表格。我只从第一行得到结果。我不知道为什么?

html文件: enter image description here

代码:

    foreach (var cell in doc.DocumentNode.SelectNodes("//table[@class = 'borders']/tbody/tr/td"))  // finder kun den første række
    {
      result.Add(cell.InnerText);
    }

结果:

enter image description here

为什么我只从第一行获得结果?

1 个答案:

答案 0 :(得分:0)

您必须使用//而不是/

//table[@class='borders']//tbody//tr//td

它为您提供所有行。

相关问题