HtmlAgilityPack - Grab data from html table

前端 未结 2 1000
别跟我提以往
别跟我提以往 2021-01-22 20:55

My program uses HtmlAgilityPack and grabs a HTML web page, stores it in a variable and I\'m trying to get from the HTML two tables which are under specific Div Class tags (board

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-22 21:26

    Try:

    foreach (HtmlNode table in 
             htmlDoc.DocumentNode.SelectNodes("//div[@class='boardcontainer']/table"))
    

    It's an XPath expression matching the attribute. See here for more info:

    http://www.exampledepot.com/egs/org.w3c.dom/xpath_getelembyattr.html

提交回复
热议问题