isXMLRoot

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

isXMLRoot(value) → returns boolean

isXMLRoot Argument Reference

value any
Required

XML Element

Examples sample code invoking the isXMLRoot function


"coldfusionengines" is root element

<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


"engine" is child of "coldfusionengines"

<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


Fork me on GitHub