46 lines
1018 B
C#
46 lines
1018 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Text.RegularExpressions;
|
|
|
|
namespace Rokojori
|
|
{
|
|
public abstract class HtmlNode
|
|
{
|
|
public enum NodeType
|
|
{
|
|
Element = 1,
|
|
Attribute = 2,
|
|
Text = 3,
|
|
CDataSection = 4,
|
|
ProcessingInstruction = 7,
|
|
Comment = 8,
|
|
Document = 9,
|
|
DocumentType = 10,
|
|
DocumentFragment = 11
|
|
}
|
|
|
|
NodeType _nodeType;
|
|
public NodeType nodeType => _nodeType;
|
|
|
|
HtmlDocument _document;
|
|
public HtmlDocument document => _document;
|
|
|
|
protected HtmlNode _parentNode;
|
|
public HtmlNode parentNode => _parentNode;
|
|
public HtmlElementNode parentElement => _parentNode as HtmlElementNode;
|
|
public void _SetParent( HtmlNode node )
|
|
{
|
|
_parentNode = node;
|
|
}
|
|
|
|
public virtual string nodeValue => null;
|
|
public virtual string textContent => "";
|
|
|
|
public HtmlNode( HtmlDocument document, NodeType type )
|
|
{
|
|
_document = document;
|
|
_nodeType = type;
|
|
}
|
|
|
|
}
|
|
} |