Determines whether the function parameter is an XML Document Object Model (DOM) attribute node.


True, if the function argument is an XML attribute node; False, otherwise.


Decision functionsXML functions

Function syntax


See also

IsXMLIsXmlDocIsXmlElemIsXmlNodeIsXmlRootXmlGetNodeTypeXmlValidateUsing XML and WDDX in the Developing ColdFusion Applications


ColdFusion MX 7: Added this function.





Name of an XML attribute


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, 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:


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');


The following example creates an XML document object and gets parts of it. It then tests whether these parts are attribute nodes.

<!--- Create an XML document object ---> 
<cfxml variable="xmlobject"> 
<order id="4323251"> 
<customer firstname="Philip" lastname="Cramer" accountNum="21"/> 
<item id="43"> 

<!--- Get an array with all lastname quantity DOM attribute nodes 
(In this example there is only one entry) ---> 
<cfset lastnames = XmlSearch(xmlobject, '//@lastname')> 

<!--- Test objects to see if they are attributes ---> 
<h3>Are the following XML Attribute nodes?</h3> 
<!--- The order element id attribute. 
This a simple variable, not a DOM attribute node.---> 
<!--- The items element ---> 
xmlobject.order.items: #IsXmlAttribute(xmlobject.order.items)#<br> 
lastnames[1] returned by XmlSearch: 

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy