欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Html Agility Pack 处理通配符

程序员文章站 2023-12-12 21:45:58
html agility pack 处理通配符 let doc = new htmlagilitypack.htmldocument() doc.loadhtml( html ) =====...
html agility pack 处理通配符


let doc = new htmlagilitypack.htmldocument()
doc.loadhtml( html )


========


let url = "https://site.site.site"


let html = new htmlagilitypack.htmlweb()
let doc0 = html.load ( url )
html.overrideencoding ->
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")








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

上一篇:

下一篇: