Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Language elements for processing XML

COBOL2000 offers language elements for reading XML documents. Such documents can be made available in files or in memory. A separate open source program package, the parser, analyzes and parses the XML document. This program package is not supplied with the COBOL compiler or CRTE, but can be downloaded from the Internet. You must make the parser available before COBOL programs which use XML language elements are executed, and ensure that it conforms with them.

The language extensions of COBOL2000 enable an XML document to be processed in two different ways:

  • structure-oriented, based on a tree presentation of the document

  • event-oriented, based on a purely sequential view of the document


Structure-oriented

Event-oriented

Language elements

As in the Technical Report "Native COBOL Syntax for XML Support"

Based on the language extension of other compiler providers

Document

In memory or file

Only in memory

Access to parts of the XML document

Any
Possible to repeat access to
same parts.

Sequential
Each part can only be acces
sed once.

Data supplied

Actual data of the document, normalized

Almost everything in the document

Additional processing effort of the parser

The document must be transferred to the tree presentation.

The document can be processed directly.

Additional memory requirement of the parser

High (for the entire tree)

Low (for administrative data)

Parser interface

DOM
(Document Object Model)

SAX (Simple API for XML)

Table 46: Comparison of structure- and event-oriented processing

To permit the new language elements to be used, the relevant option must be set when the program is compiled.