📄 tagdocument.cs
字号:
namespace Imps.Utils.TagParser
{
using System;
using System.ComponentModel;
using System.Text;
public class TagDocument
{
private TagNodeCollection mNodes = new TagNodeCollection(null);
private string mXhtmlHeader = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
internal TagDocument(string html, bool wantSpaces)
{
Parser parser = new Parser();
parser.RemoveEmptyElementText = !wantSpaces;
this.mNodes = parser.Parse(html);
}
public static TagDocument Create(string html)
{
return new TagDocument(html, true);
}
public static TagDocument Create(string html, bool wantSpaces)
{
return new TagDocument(html, wantSpaces);
}
[Description("This is the DOCTYPE for XHTML production"), Category("General")]
public string DocTypeXHTML
{
get
{
return this.mXhtmlHeader;
}
set
{
this.mXhtmlHeader = value;
}
}
[Category("Output"), Description("The HTML version of this document")]
public string HTML
{
get
{
StringBuilder builder = new StringBuilder();
foreach (TagNode node in this.Nodes)
{
builder.Append(node.HTML);
}
return builder.ToString();
}
}
public TagNodeCollection Nodes
{
get
{
return this.mNodes;
}
}
[Category("Output"), Description("The XHTML version of this document")]
public string XHTML
{
get
{
StringBuilder builder = new StringBuilder();
if (this.mXhtmlHeader != null)
{
builder.Append(this.mXhtmlHeader);
builder.Append("\r\n");
}
foreach (TagNode node in this.Nodes)
{
builder.Append(node.XHTML);
}
return builder.ToString();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -