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-52
Methods
Example
var doc = new XML.DOMDocument;
doc.load("sample.xml");
var root = doc.documentElement;
var node = root.childNodes.item(1).childNodes.item(9);
println(node.attributes.length);
node.removeAttribute("permanent");
println(node.attributes.length);
Output
2
1
removeAttributeNode
Removes the specified attribute node. If the removed attribute has a default value, it
is immediately replaced. The replacing attribute has the same namespace URI, local
name, and original prefix when applicable.
Syntax
objXMLDOMAttribute = oXMLDOMElement.removeAttributeNode(oldAttr)
Parameters
oldAttr – The XMLDOMAttribute node to remove from the attribute list.
Return Value
ObjectThe XMLDOMAttribute node that was removed.
ATPException
The following list shows the possible error-detail codes for the ATPException,
where error code is equal to ATP_ERR_DOM_EXCEPTION.
NOT_FOUND_ERR(8): This error-detail code is raised if oldAttr is not an
attribute of the element.
NO_MODIFICATION_ALLOWED_ERR(7): This error-detail code indicates
that the element is read-only.
Example
var doc = new XML.DOMDocument;
doc.load("sample.xml");
var root = doc.documentElement;
var node = root.childNodes.item(1).childNodes.item(9);
println(node.attributes.length);
var attr = node.getAttributeNode("permanent");
node.removeAttributeNode(attr);
println(node.attributes.length);