XML_GET_ATTRIBUTE
Use the XML_GET_ATTRIBUTE script function to read an element's attribute value in an XML document. Structured documentation distinguishes between text and listing attribute types, both of which can be read with the XML_GET_ATTRIBUTE script function. There is no limit to the returned value.
Syntax
XML_GET_ATTRIBUTE (Reference, @Attribute)
Script Function and Parameters
-
XML_GET_ATTRIBUTE
Retrieves the value of an element's attribute -
Reference
Reference to the element whose attribute value should be determined.
Format: script literal or script variable
Tips: References or handles let you identify and edit a position within the XML document. You can use the following script functions to retrieve handles: -
Attribute
Name of the attribute with a preceding @ character.
Format: script literal or script variable
Return Codes
This script function returns the contents of the attribute, and " " if the attribute has no value or the element has no attributes.
Examples
The following example retrieves the values of the two text-type attributes 'Name' and 'Title'.
:SET &XMLDOCU# = XML_OPEN (DOCU,"ON_CALL_SERVICES","@Details")
: SET &HND# = XML_GET_FIRST_CHILD (&XMLDOCU#)
: SET &HND# = XML_GET_NEXTSIBLING (&HND#)
: SET &NAME# = XML_GET_ATTRIBUTE (&HND#, "@Name")
: PRINT "attribute value: &NAME#"
: SET &TITLE# = XML_GET_ATTRIBUTE (&HND#, "@Title")
: PRINT "attribute value: &TITLE#"
:XML_CLOSE
The activation report shows the contents - the attribute values - of 'Name' and 'Title':
See also: