xml.childPos()

Gets the position of a child element within an XML document object. The position, in an XmlChildren array, of the Nth child that has the specified name.

xml.childPos( childName=string, index=number )

Returns: Number

Argument Description
childName
string, required

XML child element for which to search

index
number, required

Index of XMLchild element for which to search.

Examples

<cfxml variable="xmlobject">
	<office>
		<employee>
			<emp_role>lucee_dev
				<emp_name>mark</emp_name>
				<emp_id>102</emp_id>
				<emp_jobrole>software</emp_jobrole>
			</emp_role>
		</employee>
	</office>
</cfxml>
<cfset res = xmlobject.xmlroot.ChildPos("employee",1)>
<cfdump var="#res#" />

See also