Handling encoding conflicts
About this task
Your processing procedure
might
be able to handle exceptions for document encoding conflicts. Exception
events in which the parse data item is alphanumeric and the exception
code in XML-CODE
is within the range 100,001 - 165,535 or 200,001 - 265,535 indicate that the code page
of the document (as specified by its encoding declaration) conflicts
with the external code-page information.
In this special case, you can choose
to parse using the code page of the document by subtracting 100,000 or 200,000 from the value in XML-CODE
(depending on whether the code page is EBCDIC or ASCII,
respectively). For instance, if XML-CODE
contains
101,140, the code page of the document is 1140. Alternatively, you
can choose to parse using the external code page by setting XML-CODE
to
zero before returning to the parser.
The parser takes one of three actions after returning from a processing procedure for an encoding-conflict exception event:
- If
you set
XML-CODE
to zero, the parser uses the external ASCII code page or external EBCDIC code page, depending on whether the parse data item is a native alphanumeric or host alphanumeric item, respectively. - If you set
XML-CODE
to the code page of the document (that is, the originalXML-CODE
value minus 100,000 or 200,000, as appropriate), the parser uses the code page of the document.This is the only case in which the parser continues when
XML-CODE
has a nonzero value upon returning from a processing procedure. - Otherwise, the parser stops processing the document and returns
control to the
XML PARSE
statement with an exception condition.XML-CODE
contains the exception code that was originally passed with the exception event.