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
object ← DOMObject ← EventTarget ← Node
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
Fields
ATTRIBUTE_NODE
An attribute node
[DOMName("ATTRIBUTE_NODE")]
public const ushort ATTRIBUTE_NODE = 2
Field Value
CDATA_SECTION_NODE
A cdata section node
[DOMName("CDATA_SECTION_NODE")]
public const ushort CDATA_SECTION_NODE = 4
Field Value
COMMENT_NODE
A comment node
[DOMName("COMMENT_NODE")]
public const ushort COMMENT_NODE = 8
Field Value
DOCUMENT_FRAGMENT_NODE
A document fragment node
[DOMName("DOCUMENT_FRAGMENT_NODE")]
public const ushort DOCUMENT_FRAGMENT_NODE = 11
Field Value
DOCUMENT_NODE
A document node
[DOMName("DOCUMENT_NODE")]
public const ushort DOCUMENT_NODE = 9
Field Value
DOCUMENT_TYPE_NODE
A document type node
[DOMName("DOCUMENT_TYPE_NODE")]
public const ushort DOCUMENT_TYPE_NODE = 10
Field Value
ELEMENT_NODE
An element node
[DOMName("ELEMENT_NODE")]
public const ushort ELEMENT_NODE = 1
Field Value
ENTITY_NODE
An entity node
[DOMName("ENTITY_NODE")]
public const ushort ENTITY_NODE = 6
Field Value
ENTITY_REFERENCE_NODE
An entity reference node
[DOMName("ENTITY_REFERENCE_NODE")]
public const ushort ENTITY_REFERENCE_NODE = 5
Field Value
NOTATION_NODE
A notation node
[DOMName("NOTATION_NODE")]
public const ushort NOTATION_NODE = 12
Field Value
PROCESSING_INSTRUCTION_NODE
A processing instruction node
[DOMName("PROCESSING_INSTRUCTION_NODE")]
public const ushort PROCESSING_INSTRUCTION_NODE = 7
Field Value
TEXT_NODE
A text node
[DOMName("TEXT_NODE")]
public const ushort TEXT_NODE = 3
Field Value
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
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
FirstChild
The first child of this node. If there is no such node, this returns null.
[DOMName("firstChild")]
public Node FirstChild { get; }
Property Value
LastChild
The last child of this node. If there is no such node, this returns null.
[DOMName("lastChild")]
public Node LastChild { get; }
Property Value
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
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
NextSibling
The node immediately following this node. If there is no such node, this returns null.
[DOMName("nextSibling")]
public Node NextSibling { get; }
Property Value
NodeName
The name of this node, depending on its type.
[DOMName("nodeName")]
public abstract string NodeName { get; }
Property Value
NodeType
A code representing the type of the underlying object.
[DOMName("nodeType")]
public abstract ushort NodeType { get; }
Property Value
NodeValue
The value of this node, depending on its type.
[DOMName("nodeValue")]
public virtual string NodeValue { get; set; }
Property Value
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
ParentElement
Gets the parent Aspose.Html.Dom.Element of this node.
[DOMNullable]
[DOMName("parentElement")]
public Element ParentElement { get; }
Property Value
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
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
PreviousSibling
The node immediately preceding this node. If there is no such node, this returns null.
[DOMName("previousSibling")]
public Node PreviousSibling { get; }
Property Value
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
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
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
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
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
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
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
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
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
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
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
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
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
Returns node
ToString()
Returns a System.String that represents this instance.
public override string ToString()
Returns
A System.String that represents this instance.