iTP Active Transaction Pages (iTP ATP) Programmer's Guide

XML for ATP Add-On Module
iTP Active Transaction Pages (iTP ATP) Programmer’s Guide522292-002
5-16
DOMDocument Object
ATPException
The following list shows the possible error-detail codes for the ATPException,
where error code is equal to ATP_ERR_DOM_EXCEPTION.
HIERARCHY_REQUEST_ERR(3): Raised if this node is of a type that does
not allow children of the type of the newChild node, or if the node to insert is
one of this node’s ancestors.
WRONG_DOCUMENT_ERR(4): Raised if newChild was created from a
different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR(7): Raised if this node or the parent
of the new node is read-only.
NOT_FOUND_ERR(8): Raised if oldChild is not a child of this node.
Example
var doc = new XML.DOMDocument;
doc.load("sample.xml");
var root = doc.documentElement;
var newNode = doc.createElement(“REPLACE”);
root.replaceChild(newNode, root.childNodes.item(2));
DOMDocument Object
The DOMDocument object acts as the root node for all of the other nodes in the DOM
tree. It contains the root element of the document, as well as information from before the
root element and after the end of the root element.
The DOMDocument node can contain multiple XMLDOMProcessingInstruction Object
and XMLDOMComment Object nodes, and one each of the XMLDOMElement Object
and XMLDOMDocumentType Object
nodes. These nodes are treated as children, and
appear in the same sequence in which they appeared in the original XML document.
The DOMDocument object is the only one that can be created among XMLDOM
objects by the new operator; all other objects are accessed or created from the document.
Table 5-4
specifies the additional common properties of the DOMDocument object.
Table 5-4. DOMDocument Object Properties (page 1 of 2)
Property Description
doctype Contains the document type node that specifies the DTD for
this document.
documentElement Contains the root element of the document.
implementation Contains an XMLDOMImplementation Object for this
document.