How to use HTML Agility pack

后端 未结 7 1783
闹比i
闹比i 2020-11-21 04:30

How do I use the HTML Agility Pack?

My XHTML document is not completely valid. That\'s why I wanted to use it. How do I use it in my project? My project is in C#.

7条回答
  •  臣服心动
    2020-11-21 05:18

    Getting Started - HTML Agility Pack

    // From File
    var doc = new HtmlDocument();
    doc.Load(filePath);
    
    // From String
    var doc = new HtmlDocument();
    doc.LoadHtml(html);
    
    // From Web
    var url = "http://html-agility-pack.net/";
    var web = new HtmlWeb();
    var doc = web.Load(url);
    

提交回复
热议问题