HtmlAgilityPack 去网页返回内容

来源:互联网 发布:mac在线重装系统失败 编辑:程序博客网 时间:2024/06/10 11:01
引用 这个类HtmlAgilityPack


最简单的写法


//声明
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
//加载页面
htmldoctd.LoadHtml(filePrintHttp);


获取input属性为name='remark'的 value 值
string remark = htmldoctd.DocumentNode.SelectSingleNode("//input[@name='remark']").GetAttributeValue("value", "");






点InnerHtml获取标签内容


获取table下tr1下td4 值
htmldoctds.DocumentNode.SelectSingleNode("//table/tr/td[4]").InnerText;
原创粉丝点击