The table below provides an overview of the names, contents and attributes of the special registers:
Special register | Content | USAGE | Length |
XML-EVENT | Name of the event | DISPLAY | Fixed; 30 characters |
XML-CODE | Error code | COMP-5 | Fixed; 9 digits with sign |
XML-TEXT | Text connected to the event | DISPLAY | Variable; at most the length of the data item specified in the XML statement |
XML-NTEXT | NATIONAL | ||
XML-NAMESPACE | Namespace of an element, attribute or declaration | DISPLAY | |
XML-NNAMESPACE | NATIONAL | ||
XML-NAMESPACE-PREFIX | Prefix for abbreviation of a namespace | DISPLAY | |
XML-NNAMESPACE-PREFIX | NATIONAL |
XML-CODE is used for communication between the application and parser and may consequently also be modified by the application. The other special registers are supplied with values by the parser. The application should therefore only read them; writing leads to undefined behavior. The current length of the data provided in variable-length special registers must, if necessary, be determined using FUNCTION LENGTH.
When an event occurs, the parser supplies only some of the special registers with values depending on the class of the data item containing the XML document. Special registers which are not supplied with values always have the current length 0.
identifier-1 | ||
DISPLAY | NATIONAL | |
XML-EVENT | X | X |
XML-CODE | X | X |
XML-TEXT | X | – |
XML-NTEXT | –1 | X |
XML-NAMESPACE | X | – |
XML-NNAMESPACE | – | X |
XML-NAMESPACE-PREFIX | X | – |
XML-NNAMESPACE-PREFIX | – | X |
1 For the exception see the CONTENT-NATIONAL-CHARACTER event in section Processing procedure
The special registers are available in every program which was compiled using the relevant option. However, plausible values are only to be expected in the variable-length registers (i.e. lengths > 0) while an XML PARSE statement is active. The last value is still available in XML-CODE and XML-EVENT even after the statement has terminated.