rj-action-library/Runtime/Html/HtmlDocument.cs

41 lines
955 B
C#

using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace Rokojori
{
public class HtmlDocument
{
HtmlElementNode _documentElement;
public HtmlElementNode documentElement => _documentElement;
public HtmlDocument( bool addHeadAndBody = true )
{
_documentElement = HtmlElementNodeName.html.Create( this );
if ( addHeadAndBody )
{
_documentElement.AppendChild( HtmlElementNodeName.head.Create( this ) );
_documentElement.AppendChild( HtmlElementNodeName.body.Create( this ) );
}
}
public HtmlElementNode Create( HtmlElementNodeName nodeName, string text = null )
{
var element = nodeName.Create( this );
if ( text != null )
{
element.AddText( text );
}
return element;
}
public HtmlTextNode CreateText( string text )
{
return new HtmlTextNode( this, text );
}
}
}