2015-09-06 54 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