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-44
XMLDOMAttribute Object
Example
var doc = new XML.DOMDocument;
doc.validateOnParse = true;
doc.load("sample.xml");
root = doc.documentElement;
var map =
root.childNodes.item(0).childNodes.item(4).attributes;
var attr = doc.createAttribute("test");
attr.nodeValue = "true";
map.setNamedItem(attr);
for(var i=0; i<map.length; i++)
{
var node = map.item(i);
print(node.nodeName + " = " + node.nodeValue + " ");
}
Output
test = true street = Yes permanent = Yes
XMLDOMAttribute Object
The XMLDOMAttribute object represents an attribute of an XML element. Typically
the allowable values for the attribute are defined in a document type definition (DTD)
file. XMLDOMAttribute objects have all XMLDOMNode properties and methods, but
since attributes are not actually child nodes of the elements they are associated with, the
DOM does not consider them part of the document tree. Thus, the XMLDOMAttribute’s
parentNode, previousSibling, and nextSibling properties all have a null value.
You need to be aware that XMLDOMAttribute nodes have some things in common with
other objects inheriting the XMLDOMNode object, but they also are quite different.
Table 5-11
specifies the properties defined in XMLDOMNode Object that are not valid
for the XMLDOMAttribute object.
Table 5-11. XMLDOMNode Object Properties that are Not Valid for the
XMLDOMAttribute Object
Property Description
attributes Null
childNodes Null
firstChild Null
lastChild Null
nextSibling Null
parentNode Null