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-13
Methods
Example
var domDoc = new XML.DOMDocument;
domDoc.load("sample.xml");
var root = domDoc.documentElement;
var node = root.childNodes.item(1);
var newNode = node.cloneNode(true);
println(newNode.xml);
Output
<student id="NUM16001">
<name>Jenny Mabry</name>
<department>Computer Science</department>
<GPA>3.6</GPA>
<gender>Female</gender>
<address street="Yes" permanent="Yes">1010 Fargo Drive,
Cupertino, California 95014 </address>
</student>
hasChildNodes
This is a convenient method to allow easy determination of whether a node has any
children.
Syntax
var bHas = oNode.hasChildNodes()
Parameters
None.
Return Value
true if the node has any children, false if the node has no children.
Example
var domDoc = new XML.DOMDocument;
domDoc.load("sample.xml");
var root = domDoc.documentElement;
println("Does root have childNodes? " +
root.hasChildNodes());
Output
Does root have childNodes? true
insertBefore
Inserts a new node before the existing child node. If refChild is null, this inserts
newChild at the end of the list of children. If newChild is an
XMLDOMDocumentFragment Object
, all of its children are inserted, in the same
order, before refChild. If the newChild is already in the tree, it is first
removed. Note that an XMLDOMNode Object that has never been assigned to refer
to an actual node is null.