2015-09-06 97 views
0

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

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

为什么我只能从第一行的结果呢?

+0

也许是因为缺少''s – Eser

回答

0

你必须使用///

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

它给你的所有行。

+0

我得到的结果只有1行。 – MHP

+1

@MHP现在查看答案。 –

+0

是的。两个//帮助。它现在有效。 – MHP