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-26
Methods
Syntax
oNode = doc.createNode(type, name[, namespaceURI]);
Parameters
type – XMLDOMNodeType enumeration value.
name – String containing the value for the new node’s nodeName property.
namespaceURI (optional) – The namespace URI of the element to create.
Return Value
oNodeXMLDOMNode 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
The following example creates an attribute node NewAttr and adds it to the
attributes for the DOMDocument Object
:
var doc = new XML.DOMDocument;
doc.load("sample.xml");
var newNode = doc.createNode(1, "newNode");
println(newNode.xml);
Output
<newNode/>
createProcessingInstruction
Creates a XMLDOMProcessingInstruction Object node given the specified name
and data strings.
Creating a processing instruction with this method is the same as using createNode
,
where the type parameter value is NODE_PROCESSING_INSTRUCTION.