Skip to content

iterateElem(xmlID)

The iterateElem(xmlID) method iterates over all elements on the same level and returns false when there are no other elements, true otherwise.

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

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

The instruction:

var iterElem = XML.iterateElem(xmlID); 

returns true in the iterElem variable because the current main position has two elements on the same level.

The syntax is:

XML.iterateElem(xmlID);

where xmlID is the ID of the XML document.