DOCUMENTS 5 - PortalScripting API
Public Member Functions | Public Attributes | List of all members
DOMNode Class Reference


DOMNode is the base class of all tree elements in a DOMDocument. More...

Inheritance diagram for DOMNode:
DOMAttr DOMCharacterData DOMDocument DOMElement

Public Member Functions

DOMNode appendChild (DOMNode newChild)
 Append a new node to the list of child nodes. More...
 
DOMNode cloneNode (boolean deep)
 Create a duplicate of this node. More...
 
boolean hasAttributes ()
 Test, whether a node has got any associated attributes. More...
 
boolean hasChildNodes ()
 Test, whether a node has got any associated child nodes. More...
 
DOMNode insertBefore (DOMNode newChild, DOMNode refChild)
 Insert a new node into the list of child nodes. More...
 
void normalize ()
 Normalize the node ans its subtree. More...
 
DOMNode removeChild (DOMNode oldChild)
 Remove a node from the list of child nodes. More...
 
DOMNode replaceChild (DOMNode newChild, DOMNode oldChild)
 Replace a node in the list of child nodes. More...
 

Public Attributes

DOMNamedNodeMap attributes
 A map of DOM attributes. If this node is not a DOMElement, the value is null. The property is readonly.
 
DOMNodeList childNodes
 A list of all children of this node. The property is readonly.
 
DOMNode firstChild
 The first child node, otherwise null. The property is readonly.
 
DOMNode lastChild
 The last child node, otherwise null. The property is readonly.
 
DOMNode nextSibling
 The next sibling node, otherwise null. The property is readonly.
 
String nodeName
 The name of this node. The property is readonly.
 
Integer nodeType
 The type or subclass of a this node, encoded as an integer. The property is readonly.
 
String nodeValue
 The value of the node, which depends on the type. More...
 
DOMDocument ownerDocument
 The document, which owns this node. The property is readonly.
 
DOMNode parentNode
 The parent node or null. The property is readonly.
 
DOMNode previousSibling
 The previous sibling node, otherwise null. The property is readonly.
 
Node Type Constants

These constants build an enumeration of the possible values of the property nodeType. The constants are also properties of the constructor, so it is possible to read them in the style DOMNode.ELEMENT_NODE.

Integer ELEMENT_NODE
 Constant for the nodeType "Element". The actual subclass is DOMElement.
 
Integer ATTRIBUTE_NODE
 Constant for the nodeType "Attr". The actual subclass is DOMAttr.
 
Integer TEXT_NODE
 Constant for the nodeType "Text". The actual subclass is DOMCharacterData, differing from the standard.
 
Integer CDATA_SECTION_NODE
 Constant for the nodeType "CDATASection". The actual subclass is DOMCharacterData, differing from the standard.
 
Integer ENTITY_REFERENCE_NODE
 Constant for the nodeType "EntityReference". The actual implementation does not provide a subclass for this type.
 
Integer ENTITY_NODE
 Constant for the nodeType "Entity". The actual implementation does not provide a subclass for this type.
 
Integer PROCESSING_INSTRUCTION_NODE
 Constant for the nodeType "ProcessingInstruction". The actual implementation does not provide a subclass for this type.
 
Integer COMMENT_NODE
 Constant for the nodeType "Comment". The actual subclass is DOMCharacterData, differing from the standard.
 
Integer DOCUMENT_NODE
 Constant for the nodeType "Document". The actual subclass is DOMDocument.
 
Integer DOCUMENT_TYPE_NODE
 Constant for the nodeType "DocumentType". The actual implementation does not provide a subclass for this type.
 
Integer DOCUMENT_FRAGMENT_NODE
 Constant for the nodeType "DocumentFragment". The actual implementation does not provide a subclass for this type.
 
Integer NOTATION_NODE
 Constant for the nodeType "Notation". The actual implementation does not provide a subclass for this type.
 

Detailed Description


DOMNode is the base class of all tree elements in a DOMDocument.

DOMNodes cannot be created with new. Different create methods of DOMDocument can be used to create different types of nodes.

Note
Accessing any node may generate a JavaScript error, when the owning document has been deleted or "garbage collected". See the negative example at class DOMDocument.

Remarks about W3C conformity
The class covers the Node interface of DOM level 1. The underlying native library already supports at least level 2.

Since
DOCUMENTS 4.0c

Member Function Documentation

◆ appendChild()

DOMNode DOMNode::appendChild ( DOMNode  newChild)

Append a new node to the list of child nodes.

Parameters
newChildThe DOMNode to append.
Returns
The node added.
Exceptions
DOMException
Since
DOCUMENTS 4.0c

◆ cloneNode()

DOMNode DOMNode::cloneNode ( boolean  deep)

Create a duplicate of this node.

Parameters
deeptrue to clone also the whole subtree, false to clone only the node (including the attributes, if it is a DOMElement).
Returns
The copy. The actual type equals the type of this.
Remarks
The returned node initially has not got a parent.
Since
DOCUMENTS 4.0c

◆ hasAttributes()

boolean DOMNode::hasAttributes ( )

Test, whether a node has got any associated attributes.

Since
DOCUMENTS 4.0c

◆ hasChildNodes()

boolean DOMNode::hasChildNodes ( )

Test, whether a node has got any associated child nodes.

Since
DOCUMENTS 4.0c

◆ insertBefore()

DOMNode DOMNode::insertBefore ( DOMNode  newChild,
DOMNode  refChild 
)

Insert a new node into the list of child nodes.

Parameters
newChildThe DOMNode to insert.
refChildAn existing DOMNode, which already is a child of this, and which shall become the next sibling of newChild.
Returns
The node inserted.
Exceptions
DOMException
Since
DOCUMENTS 4.0c

◆ normalize()

void DOMNode::normalize ( )

Normalize the node ans its subtree.

This method restructures a DOMDocument (or a subtree of it) as if the document was written to a string and reparsed from it. Subsequent "Text" nodes without any interjacent markup are combined into one node, for example.

Since
DOCUMENTS 4.0c

◆ removeChild()

DOMNode DOMNode::removeChild ( DOMNode  oldChild)

Remove a node from the list of child nodes.

Parameters
oldChildThe child DOMNode being removed.
Returns
The node removed.
Exceptions
DOMException
Since
DOCUMENTS 4.0c

◆ replaceChild()

DOMNode DOMNode::replaceChild ( DOMNode  newChild,
DOMNode  oldChild 
)

Replace a node in the list of child nodes.

Parameters
newChildThe DOMNode to insert.
oldChildThe child DOMNode being replaced.
Returns
The node replaced.
Exceptions
DOMException
Since
DOCUMENTS 4.0c

Member Data Documentation

◆ nodeValue

String DOMNode::nodeValue

The value of the node, which depends on the type.

For several node types, the value is constantly an empty string. See also the W3C documentation in the internet.

Exceptions
DOMException

This documentation refers DOCUMENTS 5.0e (2105).
Created at 11-09-2019. - © 1998-2019 otris software AG, Königswall 21, D-44137 Dortmund. support@otris.de