Returns the first value component of the specified attribute contained in the specified element.
In the case of a single-value attribute, the function returns exactly that value.
When the attribute has a multiple (list) value
(see GOMAttribute.multiValued
),
the function returns the first value component (list item).
The returned value is represented by an object corresponding to
the attribute data type (see GOMAttribute.valueType
).
Parameters:
element
getAttrValue(contextElement, attrName)
attrName
Note: Some DSM Types may support pseudo- (or formula-) attributes. Such attributes are specified with the FlexQuery expressions which calculate the attributes' values from another (real) attributes, possible with the use of some functions.
Pseudo-attributes are treated the same way as the normal ones. (That's actually why the pseudo-attributes were introduced in the first place). Obtaining the value of a pseudo-attribute will just evoke the internal processing of its formula (therefore, if an error occurred during this, it will be reported accordingly). Externally, accessing pseudo-attributes looks the same as the accessing the normal ones. So does this function.
If the element contains no attribute with the specified name
(or in the case element == null
),
the function returns null
.
getAttrValues(), getAttrFullValue(), hasAttrValue(),
GOMAttribute.value, getValueByLPath()
(1) You may call this function in a more method-like style:
element.getAttrValue(attrName)
element.getValueByLPath("@attrName")