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 passes the following information in special registers to the processing procedure:

All other XML special registers are empty with length zero.

The processing procedure might be able to handle an exception so that parsing continues if the exception code is within one of the following ranges:

If the exception code has any other nonzero value, parsing cannot continue.

Encoding conflicts: 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 is either length zero or contains only the encoding declaration value from the document.

Exception codes 1 - 49: An exception for which the exception code is in the range 1 - 49 is a fatal error according to the XML specification. Therefore the parser does not continue normal parsing even if the processing procedure handles the exception. However, the parser does continue scanning for further errors until it reaches the end of the document, or until it encounters an error that does not permit continuation. For these exceptions, the parser does not signal any further normal events except the END-OF-DOCUMENT event.

related concepts  
XML events  
XML-CODE  
XML input document encoding
  

related tasks  
Handling XML PARSE exceptions  
Handling encoding conflicts  
Terminating XML parsing  

related references  
The encoding of XML documents  
XML PARSE exceptions    
XML specification