Html Agility Pack 处理通配符


let doc = new HtmlAgilityPack.HtmlDocument()
doc.LoadHtml( html )


========


let url = "http://Site.site.site"


let html = new HtmlAgilityPack.HtmlWeb()
let doc0 = html.Load ( url )
html.OverrideEncoding <- doc0.Encoding
let doc = html.Load ( url )








doc.DocumentNode.SelectNodes("//input")
|> Seq.map (fun i -> i.OuterHtml)
|> Seq.iter (printfn "%s")












doc.DocumentNode.SelectNodes("//input[contains(@id, 'bt')]")
|> Seq.map (fun i -> i.OuterHtml)
|> Seq.iter (printfn "%s")








doc.DocumentNode.SelectNodes("//input[contains(@name, '__')]")
|> Seq.map (fun i -> i.OuterHtml)
|> Seq.iter (printfn "%s")






doc.DocumentNode.SelectNodes("//input[starts-with(@id, 'tb')]")
|> Seq.map (fun i -> i.OuterHtml)
|> Seq.iter (printfn "%s")








http://www.w3school.com.cn/xpath/xpath_functions.