User Guide Cancel

IsXmlElem

 

Description

Determines whether the function parameter is an XML document object element.

Returns

True, if the function argument is an XML document object element; False, otherwise.

Category

Decision functionsXML functions

Function syntax

IsXmlElem(value)
IsXmlElem(value)
IsXmlElem(value)

See also

IsXMLIsXmlAttributeIsXmlDocIsXmlNodeIsXmlRootXmlGetNodeTypeXmlValidateUsing XML and WDDX in the Developing ColdFusion Applications

History

ColdFusion MX: Added this function.

Parameters

Parameter

Description

value

Name of an XML document object element

Example

The following example tests whether an XML document object, the document root, and an element are elements:

<!--- Create an XML document object --->
<cfxml variable="xmlobject">
<order id="4323251">
<customer firstname="Philip" lastname="Cramer" accountNum="21"/>
<items>
<item id="43">
<quantity>1</quantity>
<unitprice>15.95</unitprice>
</item>
</items>
</order>
</cfxml>
<!--- Test parts of the document object to see if they are elements --->
<cfoutput>
<h3>Are the following XML document object elements?</h3>
xmlobject: #IsXmlElem(xmlobject)#<br>
xmlobject.XMLRoot: #IsXmlElem(xmlobject.XMLRoot)#<br>
xmlobject.order.items: #IsXmlElem(xmlobject.order.items)#<br>
</cfoutput>
<!--- Create an XML document object ---> <cfxml variable="xmlobject"> <order id="4323251"> <customer firstname="Philip" lastname="Cramer" accountNum="21"/> <items> <item id="43"> <quantity>1</quantity> <unitprice>15.95</unitprice> </item> </items> </order> </cfxml> <!--- Test parts of the document object to see if they are elements ---> <cfoutput> <h3>Are the following XML document object elements?</h3> xmlobject: #IsXmlElem(xmlobject)#<br> xmlobject.XMLRoot: #IsXmlElem(xmlobject.XMLRoot)#<br> xmlobject.order.items: #IsXmlElem(xmlobject.order.items)#<br> </cfoutput>
<!--- Create an XML document object ---> 
<cfxml variable="xmlobject"> 
<order id="4323251"> 
<customer firstname="Philip" lastname="Cramer" accountNum="21"/> 
<items> 
<item id="43"> 
<quantity>1</quantity> 
<unitprice>15.95</unitprice> 
</item> 
</items> 
</order> 
</cfxml> 

<!--- Test parts of the document object to see if they are elements ---> 
<cfoutput> 
<h3>Are the following XML document object elements?</h3> 
xmlobject: #IsXmlElem(xmlobject)#<br> 
xmlobject.XMLRoot: #IsXmlElem(xmlobject.XMLRoot)#<br> 
xmlobject.order.items: #IsXmlElem(xmlobject.order.items)#<br> 
</cfoutput>

Get help faster and easier

New user?