isXMLRoot

Determines whether a function parameter is the root element of an Extended Markup language (XML) document object.

isXMLRoot(value) → returns boolean

Argument Reference

value any
Required

XML Element

Examples
Sample code invoking the isXMLRoot function

<cfxml variable="example">
	<coldfusionengines>
		<engine>
			<name>Adobe ColdFusion</name>
		</engine>
		<engine>
			<name>Lucee</name>
		</engine>
		<engine>
			<name>Railo</name>
		</engine>
		<engine>
			<name>Open BlueDragon</name>
		</engine>
	</coldfusionengines>
</cfxml>
<cfscript>
	writeOutput(isXMLRoot(example.coldfusionengines));
</cfscript>

Expected Result: YES

<cfxml variable="example">
	<coldfusionengines>
		<engine>
			<name>Adobe ColdFusion</name>
		</engine>
		<engine>
			<name>Lucee</name>
		</engine>
		<engine>
			<name>Railo</name>
		</engine>
		<engine>
			<name>Open BlueDragon</name>
		</engine>
	</coldfusionengines>
</cfxml>
<cfscript>
	writeOutput(isXMLRoot(example.coldfusionengines.engine));
</cfscript>

Expected Result: NO

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub