Rational Developer for System z
COBOL for Windows, Version 7.5, Programming Guide


How the XML parser handles errors

When the XML parser detects an error in an XML document, it generates an XML exception event and passes control to your processing procedure.

The parser provides the following information in special registers:

You might be able to handle the exception in your processing procedure and continue parsing if the numeric exception code is within one of the following ranges:

If the exception code has any other nonzero value, parsing cannot continue. The exceptions for encoding conflicts (50-99 and 300-399) are signaled before the parsing of the document begins. For these exceptions, XML-TEXT (or XML-NTEXT) either is zero length or contains only the encoding declaration value from the document.

Exceptions in the range 1-49 are fatal errors according to the XML specification. Therefore the parser does not continue normal parsing even if you handle the exception. However, the parser does continue scanning for further errors until it reaches the end of the document or encounters an error that does not allow continuation. For these exceptions, the parser does not signal any further normal events except the END-OF-DOCUMENT event.

Use the following figure to understand the flow of control between the parser and your processing procedure. The figure illustrates how you can handle certain exceptions and can use XML-CODE to identify the exceptions. The off-page connectors (for example, Off-page flow-chart connector.) connect the multiple charts in this information. In particular, C off-page connector. connects to the chart XML CCSID exception flow control. Within this figure, E off-page connector. and C off-page connector. serve both as off-page and on-page connectors.

Control flow for XML exceptions

This image shows a flowchart for XML exceptions, as described in surrounding text.

related tasks
Understanding the encoding of XML documents
Handling exceptions that the XML parser finds
Handling conflicts in code pages
Terminating XML parsing

related references
XML PARSE exceptions that allow continuation
XML PARSE exceptions that do not allow continuation
XML-CODE (COBOL for Windows Language Reference)


Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)