Using XML Extensions

XML Extensions allows ACUCOBOL-GT applications to interoperate freely and easily with other applications that use the Extensible Markup Language (XML) standard. To accomplish this, XML Extensions leverages the similarities between the COBOL data model and the XML data model in order to turn ACUCOBOL-GT into an XML engine. Of primary importance to this goal is the ability to import and export XML documents to and from standard COBOL data structures.

Note: A COBOL data structure, as used in this document, is a COBOL data item. The data item is frequently, but not necessarily, an 01 record-name. In general, it is a group data item, but in some cases, it may be a single elementary data item. The ACUCOBOL-GT compiler generates and embeds an XML-format symbol table in the COBOL object file when the -Ze compilation option is specified. The XML-format symbol table is used to import and export data at runtime. This XML-format symbol table is sometimes referred to in this document as the template or model.

Extensible Stylesheet Language Transformations (XSLT) of the XML data representation can be used to match XML element names to COBOL data-names in situations where the names and/or document structures differ.

By allowing standard COBOL data structures to be imported from and exported to XML documents, XML Extensions enables the direct processing and manipulation of XML-based electronic documents by the ACUCOBOL-GT application programmer. Furthermore, XML Extensions does this without requiring the application programmer to become thoroughly familiar with the numerous XML-related specifications and the time-consuming process required to emit and consume well-formed XML.

Specifically, an XML document may be imported into a COBOL data structure under COBOL program control using a single, simple COBOL statement, and, similarly, the content of a COBOL data structure may be used to generate an XML document with equal simplicity. XML Extensions' approach handles both simple and extremely complex structures with ease. Individual data elements are automatically converted as needed between their COBOL internal data types and the external coding used by XML. Not only can the transition to and from XML take place when this happens, but powerful transforms, which are coded using XSLT, can be applied at the same time. This mechanism gives XML Extensions the capabilities needed to be useful in a wide range of e-commerce and Web applications.

To add this capability to a COBOL application, the programmer need only describe the information to be received or transmitted to the external components as COBOL data definitions. This description is not required to match the XML document and, in many cases, this description will simply be an already-existing data area defined in the COBOL application.

Tip: The sample\xmlext directory of your installation contains numerous samples that use XML Extenstions and Xcentrisity BIS.