Class Node

Class Node

Namespace: Aspose.Html.Dom
Assembly: Aspose.HTML.dll (25.2.0)

The Node interface is the primary datatype for the entire Document object Model. It represents a single node in the document tree.

[ComVisible(true)]
[DOMObject]
[DOMName("Node")]
public abstract class Node : EventTarget, INotifyPropertyChanged, IEventTarget, IDisposable, IXPathNSResolver

Inheritance

objectDOMObjectEventTargetNode

Derived

Attr, CharacterData, Document, DocumentFragment, DocumentType, Element, Entity, EntityReference, Notation

Implements

INotifyPropertyChanged, IEventTarget, IDisposable, IXPathNSResolver

Inherited Members

EventTarget.AddEventListener(string, DOMEventHandler, bool), EventTarget.AddEventListener(string, IEventListener), EventTarget.AddEventListener(string, IEventListener, bool), EventTarget.RemoveEventListener(string, DOMEventHandler, bool), EventTarget.RemoveEventListener(string, IEventListener), EventTarget.RemoveEventListener(string, IEventListener, bool), EventTarget.DispatchEvent(Event), EventTarget.Dispose(), EventTarget.Dispose(bool), DOMObject.GetPlatformType(), object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

Node(Document)

Initializes a new instance of the Aspose.Html.Dom.Node class.

protected Node(Document document)

Parameters

document Document

The document.

Exceptions

ArgumentException

Fields

ATTRIBUTE_NODE

An attribute node

[DOMName("ATTRIBUTE_NODE")]
public const ushort ATTRIBUTE_NODE = 2

Field Value

ushort

CDATA_SECTION_NODE

A cdata section node

[DOMName("CDATA_SECTION_NODE")]
public const ushort CDATA_SECTION_NODE = 4

Field Value

ushort

COMMENT_NODE

A comment node

[DOMName("COMMENT_NODE")]
public const ushort COMMENT_NODE = 8

Field Value

ushort

DOCUMENT_FRAGMENT_NODE

A document fragment node

[DOMName("DOCUMENT_FRAGMENT_NODE")]
public const ushort DOCUMENT_FRAGMENT_NODE = 11

Field Value

ushort

DOCUMENT_NODE

A document node

[DOMName("DOCUMENT_NODE")]
public const ushort DOCUMENT_NODE = 9

Field Value

ushort

DOCUMENT_TYPE_NODE

A document type node

[DOMName("DOCUMENT_TYPE_NODE")]
public const ushort DOCUMENT_TYPE_NODE = 10

Field Value

ushort

ELEMENT_NODE

An element node

[DOMName("ELEMENT_NODE")]
public const ushort ELEMENT_NODE = 1

Field Value

ushort

ENTITY_NODE

An entity node

[DOMName("ENTITY_NODE")]
public const ushort ENTITY_NODE = 6

Field Value

ushort

ENTITY_REFERENCE_NODE

An entity reference node

[DOMName("ENTITY_REFERENCE_NODE")]
public const ushort ENTITY_REFERENCE_NODE = 5

Field Value

ushort

NOTATION_NODE

A notation node

[DOMName("NOTATION_NODE")]
public const ushort NOTATION_NODE = 12

Field Value

ushort

PROCESSING_INSTRUCTION_NODE

A processing instruction node

[DOMName("PROCESSING_INSTRUCTION_NODE")]
public const ushort PROCESSING_INSTRUCTION_NODE = 7

Field Value

ushort

TEXT_NODE

A text node

[DOMName("TEXT_NODE")]
public const ushort TEXT_NODE = 3

Field Value

ushort

Properties

BaseURI

The absolute base URI of this node or null if the implementation wasn’t able to obtain an absolute URI.

[DOMName("baseURI")]
public virtual string BaseURI { get; }

Property Value

string

ChildNodes

A NodeList that contains all children of this node. If there are no children, this is a NodeList containing no nodes..

public NodeList ChildNodes { get; }

Property Value

NodeList

FirstChild

The first child of this node. If there is no such node, this returns null.

[DOMName("firstChild")]
public Node FirstChild { get; }

Property Value

Node

LastChild

The last child of this node. If there is no such node, this returns null.

[DOMName("lastChild")]
public Node LastChild { get; }

Property Value

Node

LocalName

Returns the local part of the qualified name of this node. For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as Document.createElement(), this is always null.

[DOMName("localName")]
public virtual string LocalName { get; protected set; }

Property Value

string

NamespaceURI

The namespace URI of this node, or null if it is unspecified.

[DOMNullable]
[DOMName("namespaceURI")]
public virtual string NamespaceURI { get; protected set; }

Property Value

string

NextSibling

The node immediately following this node. If there is no such node, this returns null.

[DOMName("nextSibling")]
public Node NextSibling { get; }

Property Value

Node

NodeName

The name of this node, depending on its type.

[DOMName("nodeName")]
public abstract string NodeName { get; }

Property Value

string

NodeType

A code representing the type of the underlying object.

[DOMName("nodeType")]
public abstract ushort NodeType { get; }

Property Value

ushort

NodeValue

The value of this node, depending on its type.

[DOMName("nodeValue")]
public virtual string NodeValue { get; set; }

Property Value

string

OwnerDocument

The Document object associated with this node. This is also the Document object used to create new nodes. When this node is a Document or a DocumentType which is not used with any Document yet, this is null.

[DOMNullable]
[DOMName("ownerDocument")]
public virtual Document OwnerDocument { get; }

Property Value

Document

ParentElement

Gets the parent Aspose.Html.Dom.Element of this node.

[DOMNullable]
[DOMName("parentElement")]
public Element ParentElement { get; }

Property Value

Element

ParentNode

The parent of this node. All nodes, except Attr, Document, DocumentFragment, Entity, and Notation may have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is null.

[DOMName("parentNode")]
[DOMNullable]
public Node ParentNode { get; }

Property Value

Node

Prefix

The namespace prefix of this node, or null if it is unspecified. When it is defined to be null, setting it has no effect

[DOMNullable]
[DOMName("prefix")]
public virtual string Prefix { get; set; }

Property Value

string

PreviousSibling

The node immediately preceding this node. If there is no such node, this returns null.

[DOMName("previousSibling")]
public Node PreviousSibling { get; }

Property Value

Node

TextContent

This attribute returns the text content of this node and its descendants. When it is defined to be null, setting it has no effect. On setting, any possible children this node may have are removed and, if it the new string is not empty or null, replaced by a single Text node containing the string this attribute is set to.

[DOMName("textContent")]
public virtual string TextContent { get; set; }

Property Value

string

Methods

AppendChild(Node)

Adds the node newChild to the end of the list of children of this node. If the newChild is already in the tree, it is first removed.

[DOMName("appendChild")]
public Node AppendChild(Node node)

Parameters

node Node

The node to append.

Returns

Node

Returns node

CloneNode()

Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent (parentNode is null) and no user data.

[DOMName("cloneNode")]
public Node CloneNode()

Returns

Node

Returns node

CloneNode(bool)

Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent (parentNode is null) and no user data.

[DOMName("cloneNode")]
public Node CloneNode(bool deep)

Parameters

deep bool

if set to true [deep].

Returns

Node

Returns node

Dispose(bool)

Releases unmanaged and - optionally - managed resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

~Node()

Finalizes an instance of the Aspose.Html.Dom.Node class.

protected ~Node()

HasChildNodes()

Returns whether this node has any children.

[DOMName("hasChildNodes")]
public bool HasChildNodes()

Returns

bool

true if has child nodes otherwise, false.

InsertBefore(Node, Node)

Inserts the node before the existing child node child. If child is null, insert node at the end of the list of children. If child is a DocumentFragment object, all of its children are inserted, in the same order, before child. If the child is already in the tree, it is first removed.

[DOMName("insertBefore")]
public Node InsertBefore(Node node, Node child)

Parameters

node Node

The new child.

child Node

The ref child.

Returns

Node

Returns inserted node

IsDefaultNamespace(string)

This method checks if the specified namespaceURI is the default namespace or not.

[DOMName("isDefaultNamespace")]
public bool IsDefaultNamespace(string namespaceURI)

Parameters

namespaceURI string

The namespace URI.

Returns

bool

true if [is default namespace] [the specified namespace URI]; otherwise, false.

IsEqualNode(Node)

Tests whether two nodes are equal. This method tests for equality of nodes, not sameness (i.e., whether the two nodes are references to the same object) which can be tested with Node.isSameNode(). All nodes that are the same will also be equal, though the reverse may not be true.

[DOMName("isEqualNode")]
public bool IsEqualNode(Node otherNode)

Parameters

otherNode Node

The other node.

Returns

bool

true if [is equal node] [the specified arg]; otherwise, false.

IsSameNode(Node)

Returns whether this node is the same node as the given one. This method provides a way to determine whether two Node references returned by the implementation reference the same object. When two Node references are references to the same object, even if through a proxy, the references may be used completely interchangeably, such that all attributes have the same values and calling the same DOM method on either reference always has exactly the same effect.

[DOMName("isSameNode")]
public bool IsSameNode(Node otherNode)

Parameters

otherNode Node

The other node.

Returns

bool

true if [is same node] [the specified other]; otherwise, false.

LookupNamespaceURI(string)

Look up the namespace URI associated to the given prefix, starting from this node.

[DOMName("lookupNamespaceURI")]
public string LookupNamespaceURI(string prefix)

Parameters

prefix string

The prefix.

Returns

string

Returns namespace URI

LookupPrefix(string)

Look up the prefix associated to the given namespace URI, starting from this node. The default namespace declarations are ignored by this method. See Namespace Prefix Lookup for details on the algorithm used by this method.

[DOMName("lookupPrefix")]
public string LookupPrefix(string namespaceURI)

Parameters

namespaceURI string

The namespace URI.

Returns

string

Returns prefix

Normalize()

Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a “normal” form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer [XPointer] lookups) that depend on a particular document tree structure are to be used. If the parameter “normalize-characters” of the DOMConfiguration object attached to the Node.ownerDocument is true, this method will also fully normalize the characters of the Text nodes.

[DOMName("normalize")]
public void Normalize()

RemoveChild(Node)

Removes the child node indicated by oldChild from the list of children, and returns it.

[DOMName("removeChild")]
public Node RemoveChild(Node child)

Parameters

child Node

The old child.

Returns

Node

Returns node

ReplaceChild(Node, Node)

Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node. If newChild is a DocumentFragment object, oldChild is replaced by all of the DocumentFragment children, which are inserted in the same order. If the newChild is already in the tree, it is first removed.

[DOMName("replaceChild")]
public Node ReplaceChild(Node node, Node child)

Parameters

node Node

The new node.

child Node

The old child.

Returns

Node

Returns node

ToString()

Returns a System.String that represents this instance.

public override string ToString()

Returns

string

A System.String that represents this instance.