Whatever message this page gives is out now! Go check it out!

IsXmlRoot

Last update:
May 18, 2026

Description

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

Returns

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

Category

Syntax

IsXmlRoot(value)

See also

IsXMLIsXmlAttributeIsXmlDocIsXmlElemIsXmlNodeXmlGetNodeTypeXmlValidateUsing XML and WDDX in the Developing ColdFusion Applications
ColdFusion MX: Added this function.

Parameters

Parameter
Description
value
Name of an XML document object

Example

The following example tests whether an XML document object, its root element, and a child element are XML root elements:
<!--- Create an XML document object ---> 
<cfxml variable="xmlobject"> 
<?xml version="1.0" encoding="UTF-8"?> 
<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 objects to see if they are XML root elements ---> 
<cfoutput> 
<h3>Are the following the XML Root?</h3> 
xmlobject: #IsXmlRoot(xmlobject)#<br> 
xmlobject.order: #IsXmlRoot(xmlobject.order)#<br> 
<!--- The order element id attribute ---> 
xmlobject.order.XmlAttributes.id: 
#IsXmlRoot(xmlobject.order.XmlAttributes.id)#<br> 
</cfoutput>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page