如何使用HtmlAgility包从头开始创建html文档 [英] How to create an html document from scratch using the HtmlAgility pack

查看:80
本文介绍了如何使用HtmlAgility包从头开始创建html文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想使用敏捷包创建自己的简单文档,因此创建一个仅包含基本容器元素的新HtmlDocument-即

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>

如何从头开始执行此操作,而无需实际将htmldocument加载任何内容。

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

推荐答案

更容易:

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

这篇关于如何使用HtmlAgility包从头开始创建html文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆