Specifications
Child nodes
A Document can directly contain any number of Comment nodes (including the XML declaration,
which if present is always the first node of the document) and a single Element node (which is
called the document element). A Document can not contain any Text nodes and it can not contain
two or more Element nodes. The functions described in this section log an error if these restrictions
are violated.
Returns true if this element has any child nodes and
false if not.
hasChildNodes( ) : Boolean
Returns the list of child nodes of this element, in
document order, or an empty list if the element has no
child nodes.
getChildNodes( ) : NodeList
Returns the first child node of this element, or null if
there is none.
getFirstChild( ) : Node
Returns the last child node of this element, or null if
there is none.
getLastChild( ) : Node
Appends a new child node to the list of children for this
element.
appendChild( new-child : Node )
Inserts a new child node before the specified reference
node, which must be in the list of children of this
element.
insertBefore( new-child : Node,
ref-child : Node )
Removes the specified node from the list of children of
this element and returns the removed node.
removeChild( oldChild : Node ) : Node
Replaces the specified child of this element with another
node and returns the removed node.
replaceChild( newChild : Node,
oldChild : Node ) : Node
Directly accessing the document element
Returns the document element, i.e. the single element directly under
the root node (which is represented by the Document object).
getDocumentElement( ) :
Element
Sets the document element, i.e. the single element directly under
the root node (which is represented by the Document object).
setDocumentElement(
doc-element : Element )
Specifically, if before this function is called the document node
contained:
• No children at all, this function adds an XML declaration comment
and the specified document element.
• One or more children but none of them is an element, this
function appends the specified document element at the end.
• A document element, this function replaces the document element
by the specified document element.
428
Enfocus Switch 10