Skip to content

getAttrib(xmlID, attribName)

The getAttrib(xmlID, attribName) method gets the string value of the attribute in the main current position element.

It returns an empty string if:

  • There aren't attributes that match the specified attribute element name.


  • There is no current main position.


  • The main position element has no attributes.

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

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

The instruction:

var attLabel = XML.getAttrib(xmlID, "LABEL"); 

returns in the attLabel variable.

The syntax is:

XML.getAttrib(xmlID, attribName)


  • xmlID is the ID of the XML document.
  • attribName is the attribute element name from which to get the string value.