Html Agility Pack 处理通配符

当前位置 : 首页 > 网页制作 > html5 > Html Agility Pack 处理通配符

Html Agility Pack 处理通配符

来源: 作者: 时间:2016-02-01 11:22
Html Agility Pack 处理通配符let doc = new HtmlAgilityPack HtmlDocument()doc LoadHtml( html )========let url = http: Site site site let html = new HtmlAgilityPack H
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.
Tag:
网友评论

<