User Guide

696 Chapter 3: ColdFusion Functions
IsXmlAttribute
Description
Determines whether the function parameter is an XML Document Object Model (DOM)
attribute node.
Returns
True, if the function argument is an XML attribute node; False, otherwise.
Category
Decision functions, XML functions
Function syntax
IsXmlAttribute(value)
See also
IsXML
, IsXmlDoc, IsXmlElem, IsXmlNode, IsXmlRoot, XmlGetNodeType, XmlValidate,
Chapter 35, “Using XML and WDDX” in ColdFusion MX Developers Guide
History
ColdFusion MX 7: Added this function.
Parameters
Usage
This function determines whether the parameter is an XML DOM attribute node, a node with an
XMLType value of ATTRIBUTE. It is useful for determining whether a value returned by the
XmlSearch function is an XML attribute.
The DOM, and therefore ColdFusion MX, treats XML attributes as properties of an element and
does not directly expose them as DOM nodes. For this reason, the
XmlAttributes entries in
ColdFusion XML document objects do not represent DOM attribute nodes, and tests such as the
following always return False:
IsXmlAttribute(myxmlelement.XMlAttributes);
IsXmlAttribute(myxmlelement.XMlAttributes.myattribute);
The XmlSearch function does return attributes as XML DOM attribute nodes. For example, the
following line returns an array of attribute nodes containing the quantity attributes in the
xmlobject document object:
quantities = XmlSearch(xmlobject, '//@quantity');
Example
The following example creates an XML document object and gets parts of it. It then tests whether
these parts are attribute nodes.
Parameter Description
value Name of an XML attribute