Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create an html document from scratch using the HtmlAgility pack

I just wanted to create my own simple document using the agility pack so create a new HtmlDocument that contains just the basic container elements - i.e.

<html><head></head><body></body></html>

How can I do this from scratch without actually loading the htmldocument with anything.

like image 758
Pittfall Avatar asked Jan 11 '12 16:01

Pittfall


1 Answers

Even easier:

var doc = new HtmlDocument();
var node = HtmlNode.CreateNode("<html><head></head><body></body></html>");
doc.DocumentNode.AppendChild(node);
like image 148
Jeff Mercado Avatar answered Sep 28 '22 04:09

Jeff Mercado