Skip to content

getTagName(xmlID)

The getTagName(xmlID) method returns the tag name of the current main position element.

If there is no current position, it returns an empty string.

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

The instruction:

var tagName = XML.getTagName(xmlID); 

returns DOMAIN in the tagName variable.

The syntax is:

XML.getTagName(xmlID);

where xmlID is the ID of the XML document.