The XMLDocument class is the main XML class.

The XMLDocument class defines the following methods.

Method

Returns

Description

appendChild(XMLNode):Object

Object

Adds a newChild node to the end of the list of child nodes of this node. If the newChild node exists in the tree, it is first removed.

cloneNode(boolean):Object

Object

Clones a node.

createCDATASection(Object):XMLNode

XMLNode

Creates a CDATA node.

createComment(String):XMLNode

XMLNode

Creates a comment node.

createElement(String):XMLElement

XMLElement

Creates an element with a given name.

createProcessingInstruction(String,String):XMLNode

XMLNode

Creates a ProcessingInstruction node with specified name and data strings.

createTextNode(String):XMLNode

XMLNode

Creates a text node.

getChildNodes():Object

Object

Gets all child nodes.

getDocumentElement():XMLElement

XMLElement

Allows direct access to the child node that is at the root element of the document.

getElementsByTagName(String):Object

Object

Returns an XMLNodeList of all elements with a given tag name in the order in which they are encountered in a pre-ordered traversal of the XMLDocument tree.

insertBefore(XMLNode,XMLNode):Object

Object

Inserts a newChild node before the existing child node refChild. If refChild is null, the newChild node is inserted at the end of list of child nodes. If the newChild node exists in the tree, it is first removed.

normalize():Object

Object

Normalizes the document.

removeChild(XMLNode):Object

Object

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

replaceChild(XMLNode,XMLNode):Object

Object

Replaces the oldChild node with a newChild node in the list of child nodes and returns the oldChild node. If the newChild node exists in the tree, it is first removed.