从字符串加载而不是文档/网址

问题描述:

我刚刚发现了关于html敏捷包的问题,​​我试了一下,但偶然发现了一个问题。无法在网上找到任何东西,所以在这里尝试。从字符串加载而不是文档/网址

你知道我如何从一个字符串而不是文档/ URL加载html吗?

感谢

您是否尝试过使用LoadHtml

string htmlString = 'Your html string here...'; 

HtmlAgilityPack.HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument(); 
htmlDocument.LoadHtml(htmlString); 

// Do whatever with htmlDocument here 

我认为有一个功能可以做到这一点吗?

HtmlDocument doc = new HtmlDocument(); 
      doc.LoadHtml("<test>"); 

此帖可能有点旧。我认为这会帮助他人。

 WebBrowser web_browser = new WebBrowser(); 
     web_browser.DocumentText = html_contents_as_string; 

     do 
     { 
      Application.DoEvents(); 
     } while (web_browser.ReadyState != WebBrowserReadyState.Complete);