Processing XML input

You can process XML input in a COBOL program by using the XML PARSE statement.

The XML PARSE statement is the COBOL language interface to the high-speed XML parser that is part of the COBOL run time.

Processing XML input involves passing control between the XML parser and a processing procedure in which you handle parser events.

Use the following COBOL facilities to process XML input:

  • The XML PARSE statement to begin XML parsing and to identify the source XML document and the processing procedure
  • The processing procedure to control the parsing, that is, receive and process XML events and associated document fragments, and return to the parser for continued processing
  • Special registers to exchange information between the parser and the processing procedure:
    • XML-CODE to receive the status of XML parsing and, in some cases, to return information to the parser
    • XML-EVENT to receive the name of each XML event from the parser
    • XML-NTEXT to receive XML document fragments that are returned as national character data
    • XML-TEXT to receive document fragments that are returned as alphanumeric data

Related concepts  
XML parser in COBOL