HtmlAgilityPack and selecting Nodes and Subnodes

前端 未结 5 1350
轻奢々
轻奢々 2021-01-31 02:12

Hope somebody can help me.

Let´s say I have a html document that contains multiple divs like this example:

5条回答
  •  无人及你
    2021-01-31 02:39

    I used that. class convert id

      HtmlNodeCollection nodes = dokuman.DocumentNode.SelectNodes("//div[@id='search_hit']//span[@prop]");
    
    
                for (int i = 0; i < nodes .Count; i++)
            {
                var record = new Record();
    
    
                    record.Name = links[i].InnerText;   results.Add(record);  }
    

提交回复
热议问题