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")
<input id="tb_user" class="textbox_sty2" ...>
<input id="tb_pass" class="textbox_sty2" ...>
<input id="bt_ok" ...>
<input id="bt_cancle" ...>
<input type="hidden" name="__EVENTTARGET">
<input type="hidden" name="__EVENTARGUMENT">
doc.DocumentNode.SelectNodes("//input[contains(@id, ‘bt‘)]")
|> Seq.map (fun i -> i.OuterHtml)
|> Seq.iter (printfn "%s")
<input id="bt_ok" ...>
<input id="bt_cancle" ...>
doc.DocumentNode.SelectNodes("//input[contains(@name, ‘__‘)]")
|> Seq.map (fun i -> i.OuterHtml)
|> Seq.iter (printfn "%s")
<input type="hidden" name="__EVENTTARGET">
<input type="hidden" name="__EVENTARGUMENT">
doc.DocumentNode.SelectNodes("//input[starts-with(@id, ‘tb‘)]")
|> Seq.map (fun i -> i.OuterHtml)
|> Seq.iter (printfn "%s")
<input id="tb_user" class="textbox_sty2" ...>
<input id="tb_pass" class="textbox_sty2" ...>
http://www.w3school.com.cn/xpath/xpath_functions.asp
相关文章
- 07-29开源项目Html Agility Pack实现快速解析Html
- 07-29C#解析HTML利器-Html Agility Pack
- 07-29Html Agility Pack解析HTML页
- 07-29HTML Agility Pack 搭配 ScrapySharp,彻底解除Html解析的痛苦
- 07-29HTML Agility Pack 搭配 ScrapySharp,彻底解除Html解析的痛苦(转)
- 07-29Html Agility Pack基础类介绍及运用
- 07-29HTML Agility Pack 搭配 ScrapySharp,彻底解除Html解析的痛苦
- 07-29一款很不错的html转xml工具-Html Agility Pack
- 07-29Html Agility Pack
- 07-29使用Html Agility Pack快速解析Html内容