XML-CODE
For each XML event except an EXCEPTION
event,
the parser sets the value of the XML-CODE
special
register to zero. For an EXCEPTION
event, the parser
sets XML-CODE
to a value that identifies the specific
exception.
For information about the possible exception codes, see the related references.
When
the parser returns control to the XML PARSE
statement
from your processing procedure, XML-CODE
generally contains
the most recent value that was set by the parser. However, for any event other than EXCEPTION
,
if you set XML-CODE
to -1 in your processing procedure,
parsing terminates with a user-initiated exception condition when
control returns to the parser, and XML-CODE
retains
the value -1.
For an EXCEPTION
XML
event when XMLPARSE(COMPAT)
is
in effect, your processing procedure can, in some cases, set XML-CODE
to a meaningful value
before control returns to the parser. (For details, see the related
tasks about handling XML PARSE
exceptions and handling
encoding conflicts.) If you set XML-CODE
to any other
nonzero value or set it for any other exception, the parser resets XML-CODE
to
the original exception code.
For a START-OF-DOCUMENT
XML
event when compiler option XMLPARSE(COMPAT)
is in
effect, your processing procedure can set XML-CODE
to
1 before control returns to the parser. This action instructs the
parser to release (at the end of parsing) any Language Environment® resources acquired during
parsing.
The following table shows the results of setting XML-CODE
to
various values. The leftmost column shows the type of XML event passed
to the processing procedure; the other column headings show the XML-CODE
value
set by the processing procedure. The cell at the intersection of each
row and column shows the action that the parser takes upon return
from the processing procedure for a given combination of XML event
and XML-CODE
value.
XML event type | XML-CODE set to -1 | XML-CODE set to 0 | XML-CODE set to 1 | XML-CODE set to other nonzero values |
---|---|---|---|---|
Fatal EXCEPTION |
Ignores setting; keeps original XML-CODE value |
Ignores setting; keeps original XML-CODE value |
Ignores setting; keeps original XML-CODE value |
Ignores setting; keeps original XML-CODE value |
Warning EXCEPTION (Reason
code 800 or 801) |
Ignores setting; keeps original XML-CODE value |
Next event is ATTRIBUTE-NAME or START-OF-ELEMENT |
Ignores setting; keeps original XML-CODE value |
Ignores setting; keeps original XML-CODE value |
END-OF-INPUT |
Ends immediately; XML-CODE = -11 |
Next event is END-OF-DOCUMENT 2 |
Next event depends on input2 | Fatal runtime error (message 230S) |
Normal event | Ends immediately; XML-CODE = -11 |
XML-CODE already 0, no change |
Fatal runtime error (message 230S) | Fatal runtime error (message 230S) |
|
XML event type | -1 | 0 | XML-CODE -100,000 |
Other nonzero value |
---|---|---|---|---|
Encoding-conflict exception (exception codes 50 - 99) | Ignores setting; keeps original XML-CODE value |
Chooses encoding depending on the specific exception code1 | Ignores setting; keeps original XML-CODE value |
Ignores setting; keeps original XML-CODE value |
Encoding-choice exception (exception codes > 100,000) | Ignores setting; keeps original XML-CODE value |
Parses using the CODEPAGE value2 |
Parses using the difference (shown above) as the encoding value2 | Ignores setting; keeps original XML-CODE value |
Other exception | Ignores setting; keeps original XML-CODE value |
Limited continuation only for exception codes 1 - 493 | Ignores setting; keeps original XML-CODE value |
Ignores setting; keeps original XML-CODE value |
Normal event (except START-OF-DOCUMENT ) |
Ends immediately; XML-CODE = -14 |
[No apparent change to XML-CODE ] |
Ends immediately; XML-CODE = -1 |
Ends immediately; XML-CODE = -1 |
START-OF-DOCUMENT |
Ends immediately; XML-CODE = -14 |
[No apparent change to XML-CODE ] |
Ends immediately; XML-CODE = -1 |
|
|
XML generation also uses the XML-CODE
special
register. For details, see the related task about handling XML
GENERATE
exceptions.
Writing procedures to process XML
Parsing XML documents one segment at a time
Handling XML PARSE exceptions
Terminating XML parsing
Handling XML GENERATE exceptions
XML PARSE exceptions with XMLPARSE(XMLSS) in effect
XML PARSE exceptions with XMLPARSE(COMPAT) in effect
XML GENERATE exceptions
XML-CODE (Enterprise COBOL for z/OS Language Reference)
XML-EVENT (Enterprise COBOL for z/OS Language Reference)