• XPath


    https://www.cnblogs.com/yukaizhao/archive/2011/07/25/xpath.html
    var result = GetStringByUrl(textBox1.Text.Trim());               
                    HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
                    doc.LoadHtml(result);
                    //HtmlAgilityPack.HtmlNodeCollection HNc = doc.DocumentNode.SelectNodes("//div[@class='house-title']/h1");
    
                    var titleNode = doc.DocumentNode.SelectSingleNode("//h1[@class='c_333 f20']").InnerText;
                    var chanquan = doc.DocumentNode.SelectSingleNode("//span[contains(text(),'产权年限')]/following-sibling::span").InnerText;
                    var xiaoqu = doc.DocumentNode.SelectSingleNode("//span[@class='c_000 mr_10']").InnerHtml;
    
                    var mianqi = doc.DocumentNode.SelectSingleNode("//span[contains(text(),'房本面积')]/following-sibling::span").InnerHtml;
                    var maidian = doc.DocumentNode.SelectSingleNode("//p[@class='pic-desc-word']").InnerHtml.Replace("<br>","");
                    var chaoxiang = doc.DocumentNode.SelectSingleNode("//span[contains(text(),'建筑年代(暂无信息)')]/preceding-sibling::span").InnerHtml;
                    var price = doc.DocumentNode.SelectSingleNode("//p[@class='house-basic-item1']/span").InnerHtml.Replace("<b>","").Replace("</b>","");
                    var shiting = doc.DocumentNode.SelectSingleNode("//p[@class='room']/span[contains(text(),'室')]").InnerText;
                    var jiaoyi = doc.DocumentNode.SelectSingleNode("//span[contains(text(),'交易')]/following-sibling::span").InnerText;
                    var jiege = doc.DocumentNode.SelectSingleNode("//span[@class='unit']").InnerHtml;
  • 相关阅读:
    百度脑图源码
    H5与Native交互的实现
    【GOF23设计模式】建造者模式
    【GOF23设计模式】工厂模式
    【GOF23设计模式】单例模式
    Linux符设备驱动编程
    linux多线程编程——读者优先、写者优先问题
    建立makefile
    构建交叉开发环境
    Failed to create the part's controls解决方法
  • 原文地址:https://www.cnblogs.com/zhang1997/p/9100513.html
Copyright © 2020-2023  润新知