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-24
Methods
Parameters
tagName – The name of the element type to instantiate.
namespaceURI (optional) – The namespace URI of the element to create.
Return Value
objElementXMLDOMElement Object
.
ATPException
The following list shows the possible error-detail codes for the ATPException,
where error code is equal to ATP_ERR_DOM_EXCEPTION.
INVALID_CHARACTER_ ERR(5): Raised if the specified qualified name
contains an invalid character.
NAMESPACE_ERR(14): The name is malformed if:
°
The name has a prefix and the namespaceURI is null or an empty string
°
The name has a prefix that is “xml” and the namespaceURI is different from
“http://www.w3.org/XML/1998/namespace”
°
The name has a prefix that is “xmlns” and the namespaceURI is different
from “http://www.w3.org/2000/xmlns/”
°
The name is “xmlns” and the namespaceURI is different from
“http://www.w3.org/2000/xmlns/”
Example
var doc = new XML.DOMDocument;
doc.validateOnParse = true;
doc.load("sample.xml");
var node =
doc.documentElement.childNodes.item(0).childNodes.item(0);
var elem = doc.createElement("newElement");
node.appendChild(elem);
println(node.xml);
Output
<name>Jenny Mabry<newElement/></name>
createEntityReference
Creates a new XMLDOMEntityReference Object. Creating an entity reference with
this method is the same as using createNode where the type parameter value is
NODE_ENTITY_REFERENCE. Although this method creates the new object in the
context of this document, it does not automatically add the new object to the
document tree.
Syntax
objEntityRef = doc.createEntityReference(name);