HtmlAgilityPack: Get whole HTML document as string

c# html-agility-pack

Question

Does HtmlAgilityPack have the ability to return the whole HTML markup from an HtmlDocument object as a string?

Accepted Answer

Sure, you can do like this:

HtmlDocument doc = new HtmlDocument();
// call one of the doc.LoadXXX() functions
Console.WriteLine(doc.DocumentNode.OuterHtml);

OuterHtml contains the whole html.



Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why