2012-01-11 14 views
6

Chciałem stworzyć własny prosty dokument przy użyciu pakiet agility więc utworzyć nowy HTMLDocument który zawiera tylko podstawowe elementy Container - tjJak utworzyć dokument HTML od podstaw przy użyciu pakiet HtmlAgility

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

Jak mogę to zrobić od zera bez faktycznego ładowania htmldocumenta cokolwiek.

+0

Należy również oznakować to z .net - a pierwsze zdanie wydaje się niekompletny. Nie wiedząc, że pakiet agility jest czymś więcej niż tylko klikaniem go w parę minut temu, przypuszczam, że będziesz musiał zacząć od minimalnego dokumentu. – Fildor

+0

I zdobione 'HtmlAgilityPack.HtmlDocument HTMLDocument = new HtmlAgilityPack.HtmlDocument(); HtmlAgilityPack.HtmlNode htmlNode = htmlDocument.CreateElement ("Kopiuj"); HtmlAgilityPack.HtmlNode headNOde = htmlDocument.CreateElement ("głową"); HtmlAgilityPack.HtmlNode bodyNode = htmlDocument.CreateElement ("korpus"); htmlNode.AppendChild (headNode); htmlNode.AppendChild (bodyNode); htmlDocument.DocumentNode.AppendChild (htmlNode) ' – Pittfall

Odpowiedz

20

Jeszcze prościej

var doc = new HtmlDocument(); 
var node = HtmlNode.CreateNode("<html><head></head><body></body></html>"); 
doc.DocumentNode.AppendChild(node); 
Powiązane problemy