ILE COBOL provides an event-based interface that enables you to parse XML documents and transform them to COBOL data structures. The XML parser finds fragments (associated with XML events) within the document, and your processing procedure acts on these fragments. You code your procedure to handle each XML event. Throughout this operation, control passes back and forth between the parser and your procedure.
You start this exchange with the parser by using the XML PARSE statement, in which you designate your processing procedure. Execution of this XML PARSE statement begins the parse and establishes your processing procedure with the parser. Each execution of your procedure causes the XML parser to continue analyzing the XML document and report the next event, passing back to your procedure the fragment that it finds, such as the start of a new element. You can also specify on the XML PARSE statement two imperative statements to which you want control to be passed at the end of the parse: one when a normal end occurs and one when an exception condition exists.
This figure gives a high-level overview of the basic exchange of control between the parser and your program:
Normally, parsing continues until the entire XML document has been parsed.
When the XML parser parses XML documents, it checks them for most aspects of well formedness as defined in the XML specification. A document is well formed if it adheres to the XML syntax and follows some additional rules such as proper use of end tags and uniqueness of attribute names.
related tasks
Accessing XML documents
Parsing XML documents
Writing procedures to process XML
Handling errors in XML documents
Understanding XML document encoding
related reference
XML specification (www.w3c.org/XML/)
XML conformance
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.