CALL "C$XML" USING CXML-GET-ATTRIBUTE, handle attr-num attr-name attr-value
|CXML-GET-ATTRIBUTE||Op-code 8. Numeric data item that specifies the operation to perform. Each operation is defined in acucobol.def, which is included with your system.|
|handle||Is an element handle or parser handle. If handle is a parser handle, it is first set to the handle of the top-level element of the parsed file.|
|attr-name||the name of the attribute|
|attr-value||The attribute's value|
If the return-code is “0”, it can mean that there are no elements, or that the passed handle is not a valid handle. Query on the last error with op-code CXML-GET-LAST-ERROR to determine which is the case.
Before you use CXML-GET-ATTRIBUTE, we recommend that you use CXML-GET-ATTRIBUTE-COUNT. This op-code tells you how many attributes are in the element of interest. Then when you use CXML-GET-ATTRIBUTE, you know which attribute you are getting (the first attribute is number 0, the second number 1, etc.). Alternatively, if you know the name of the attribute you want and not the number of the attribute, you can use CXML-GET-ATTRIBUTE-BY-NAME. If you have an unknown number of attributes like this:
Limousine xmlns:tsd="http://namespaces.softwareag.com/tamino/TaminoSche maDefinition" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
and you are searching for a particular attribute, say "xmlns:xsi", you can search for the value with CXML-GET-ATTRIBUTE-BY-NAME, or you can get the count and read the attributes one by one searching for the one you want.