iTP Active Transaction Pages (iTP ATP) Programmer's Guide
XML for ATP Add-On Module
iTP Active Transaction Pages (iTP ATP) Programmer’s Guide—522292-002
5-21
Methods
Parameters
name – The name of the attribute.
namespaceURI (optional) – The namespace URI of the attribute to create.
Return Value
objAttribute – XMLDOMAttribute 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 newAttr = doc.createAttribute("status");
newAttr.nodeValue = "new";
node.setAttributeNode(newAttr);
println(node.xml);
Output
<name status="new">Jenny Mabry</name>
createCDATASection
Creates an XMLDOMCDATASection Object that contains the supplied data.
Creating a CDATA section with this method is the same as using createNode where
the type parameter value is NODE_CDATA_SECTION and no namespace is
specified. 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.