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

Dar*_*rko 23 c# html-agility-pack

我刚刚发现了关于html敏捷包的问题,​​我试过了,但偶然发现了一个问题.我在网上找不到任何东西,所以我在这里尝试.

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

谢谢.

oha*_*aal 55

你尝试过使用LoadHtml吗?

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

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

// Do whatever with htmlDocument here
Run Code Online (Sandbox Code Playgroud)