ILE COBOL Programmer's Guide


Understanding XML document encoding

The XML PARSE statement supports only XML documents that contain one of the following types of data items:

If your XML document includes an encoding declaration, ensure that it is consistent with the encoding information provided by your XML PARSE statement and with the basic encoding of the document. The parser determines the encoding of a document by using up to three sources of information in the following order:

  1. The initial characters of the document
  2. The encoding information provided by your XML PARSE statement
  3. If step 2 succeeds, an encoding declaration in the document

Thus if the XML document begins with an XML declaration that includes an encoding declaration specifying one of the supported code pages, the parser honors the encoding declaration if it does not conflict with either the basic document encoding or the encoding information from the XML PARSE statement.

If the XML document does not have an XML declaration, or if the XML declaration omits the encoding declaration, the parser uses the encoding information from your XML PARSE statement to process the document, as long as it does not conflict with the basic document encoding.

The parser signals an XML exception event if it finds a conflict among these sources.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]