xmlChildPos

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.

xmlChildPos(elem, childname, n) → returns numeric

Argument Reference

elem xml
Required

XML element within which to search

childname string
Required

XML child element for which to search

n numeric
Required

Index of XML child element for which to search

Examples
Sample code invoking the xmlChildPos function

The second item element is the third child of list, because a note element comes before it.

doc = xmlParse( "<list><item>A</item><note>X</note><item>B</item></list>" );
writeOutput( xmlChildPos( doc.list, "item", 2 ) );

Expected Result: 3

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

Fork me on GitHub