2012-02-27 22 views
15

私はちょうどhtmlアジリティパックについて知りましたが、試しましたが、問題が発生しました。ウェブ上で何かを見つけることができなかったので、ここで試してみてください。ドキュメント/ URLの代わりに文字列からロード

document/URLの代わりに文字列からhtmlを読み込む方法を知っていますか?

おかげ

答えて

42

あなたはLoadHtmlを使用してみましたか?

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

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

// Do whatever with htmlDocument here 
1

私にはそうする機能があると思いますか?

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

この投稿は古いかもしれません。私はそれが他人を助けると思う。

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

     do 
     { 
      Application.DoEvents(); 
     } while (web_browser.ReadyState != WebBrowserReadyState.Complete); 
関連する問題