Skip to content

iterateChildElem(xmlID)

The iterateChildElem(xmlID) method iterates over all the children of an element and returns false when there are no other children, true otherwise.

For example, considering the following XML document and the related current positions:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DOMAINTREE>
    <DOMAIN NAME="1" LABEL="one">                           <-- Parent position
        <DOMAIN NAME="1.1" LABEL="one.one">                 <-- Main position
            <DOMAIN NAME="1.1.1" LABEL="one.one.one"/>      <-- Child position 1
            <DOMAIN NAME="1.1.2" LABEL="one.one.two"/>      <-- Child position 2
        </DOMAIN>
    </DOMAIN>
    <DOMAIN NAME="2" LABEL="two"/>
    <DOMAIN NAME="3" LABEL="three"/>
</DOMAINTREE>

The instruction:

var iterChildren = XML.iterateChildElem(xmlID); 

returns true in the iterChildren variable, because the current main position has two children.

The syntax is:

XML.iterateChildElem(xmlID);

where xmlID is the ID of the XML document.