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, childName, index )

Returns: Number

Argument Description
node
xml, required

XML element within which to search.

childName
string, required

XML child element for which to search

index
number, required

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