2014-09-24 32 views
0

我使用HTML敏捷性包和Fizzler(所以我可以使用CSS選擇器)來刮取結果頁面。精煉HTML敏捷包節點

我首先創建html文檔,然後創建一個節點列表,以便每個節點都是單獨的結果。

IEnumerable<HtmlNode> sections = document.DocumentNode.QuerySelectorAll("selector"); 

我現在想深入瞭解每個節點,以獲取我想要的特定數據,但我迷失在這裏。

我想:

foreach (HtmlNode n in sections) 
{ 
    var phone = n.QuerySelectorAll("selector"); 

    string myVar = phone.InnerHtml; // this doesn't work, the innerhtml property is not there. 
} 

誰能告訴我如何處理呢?我所見過的所有例子都停在創建節點列表上。

回答

0

好吧,這是愚蠢的簡單。我需要使用QuerySelector而不是QuerySelectorAll