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( node=xml, childName=string, index=number );
Returns: Number
Examples
xml_stream = "
<notes>
<note>
<to>Alice</to>
<from>Bob</from>
<heading>Reminder</heading>
<body>Here is the message you requested.</body>
</note>
<author>
<first>John</first>
<last>Doe</last>
</author>
</notes>
";
xml_document = XmlParse(xml_stream);
xml_root = xml_document.XmlRoot;
dump(XmlChildPos(xml_root,"author",1)); // 2
See also
- XML
- xml.childPos()
- Search Issue Tracker
- Search Lucee Test Cases (good for further, detailed examples)