Skip to content

outOfElem(xmlID)

The outOfElem(xmlID) method moves the parent position to the main position and the child position (if any) moves to the previous main position.

Note

This method is used to go up the document level following intoElem(xmlID), used to go deeper in the document level.

The method returns false if the current position is already at the top of the document.

For example, considering the following XML document:

<?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
            <DOMAIN NAME="1.1.2" LABEL="one.one.two"/>
        </DOMAIN>
    </DOMAIN>
    <DOMAIN NAME="2" LABEL="two"/>
    <DOMAIN NAME="3" LABEL="three"/>
</DOMAINTREE>

If the main position is located on the DOMAIN element that has the attributes NAME = 1.1 and LABEL = one.one, the following instruction:

XML.outOfElem(xmlID); 

moves the positions as follows:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DOMAINTREE>                                    <-- Parent current position
    <DOMAIN NAME="1" LABEL="one">               <-- Main current position
        <DOMAIN NAME="1.1" LABEL="one.one">     <-- Child current 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"/>
    <DOMAIN NAME="3" LABEL="three"/>
</DOMAINTREE>

The syntax is:

XML.outOfElem(xmlID);

where xmlID is the ID of the XML document.