Corporate Info | News | Solutions | Products | Partners | Services | Events | Download | How To Buy
WebLogic Java Adapter for Mainframe User Guide Doc Home | BEA WebLogic Java Adapter for Mainframe User Guide | Previous Topic | Next Topic | Contents | Index

Understanding How JAM Uses XML

BEA WebLogic Java Adapter for Mainframe uses the capabilities of XML to exchange data between different applications and operating systems. Understanding basic XML terms will help you to understand JAM's XML capabilities and how they are used.

This section discusses the following topics:

- What is XML?

  - Document Type Definition

  - XML Schema

- JAM XML Capabilities

What is XML?

Extended Markup Language, or XML, is a text format for exchanging data between different systems. It allows data to be described in a simple, standard, text-only format. Since the data is presented in a standard form, applications on disparate systems can interpret the data using simple text parsing tools, instead of having to interpret data in proprietary binary formats.

XML documents come in two varieties: data and metadata.

- XML Data Document

  Data records can be converted into XML documents, which can then be transmitted to other applications. The XML data documents contain a single top-level entity (or tag) that represents the entire data record. Fields within the record are represented by other subordinate entities nested within the top-level entity. Each entity has a unique tag name, which corresponds to a field within the original data record. Each entity has content, which is the actual data value of the field. Entities may also have attributes, which are values attached to the entities that augment the normal content values. The XML data document file name ends with a .xml extension.

  See Listing 2-2 for an example XML data document.

- XML Metadata

  Every XML document consists of a top-level entity, which in turn may be composed of subordinate entities. The structure of these entities, which included their tag names, the order in which they occur, the type and length of their content values, and their allowed attribute values, is described by a metadata definition. Metadata definitions can take the form of XML documents themselves. There are two standard formats for XML metadata documents: XML Document Type Definition (DTD) and XML Schema.

Document Type Definition

A document type definition, or DTD, defines the legal building blocks of an XML document. It defines the document structure with a list of legal elements (tags). While XML provides an application independent way of sharing data, the DTD provides a common definition for interchanging data.

Your application can use a standard DTD to verify that data that you receive from the outside world is valid. You can also use a DTD to verify your own data.

The XML DTD file name ends with a .dtd extension.

See Listing 2-4 for an example XML DTD document.

XML Schema

A schema specifies the structure of an XML document and constraints on its content. While XML is the meta-language that provides the rules for defining tag languages, an XML Schema document is a formal specification of the grammar for a particular tag language. The schema defines the elements that can appear within the document and the attributes that can be associated with an element. It also defines the structure of the document: which elements are child elements of others, the sequence in which the child elements can appear, and the number of child elements. It defines whether an element is empty or can include text. The schema can also define default values for attributes.

XML Schema is more precise than DTD, providing more descriptive information about each XML element. It is likely that XML Schema will eventually replace XML DTD as the dominant standard metadata format.

A schema is useful for validating the document content to determine whether a document is a valid instance of the grammar expressed by that schema and for describing your grammar for use by others.

The XML Schema file name ends with a .xsd extension.

See Listing 2-3 for an example XML Schema document.

JAM XML Capabilities

The JAM eGen tools provide the ability to generate both XML Schema and XML DTD documents for a given COBOL copybook record definition.

The JAM runtime environment provides the capability of converting data records into XML data documents, formatting according to their corresponding schema or DTD definitions.

The following listings show examples of the XML files generated by the eGen COBOL Copybook Utility from the COBOL Copybook for an employee information record.

Listing 2-1 shows an example of an employee information record from a COBOL Copybook. The eGen COBOL Copybook Utility generates an XML document, an XML Schema, and a DTD from the employee information record. Listing 2-2 shows the XML document generated from the employee record information, Listing 2-3 shows the XML Schema, and Listing 2-4 shows the DTD.

Listing 2-1 COBOL Copybook for Employee Information Record (emprec.cpy)

>     *--------------------------------------------------------
>     * emprec.cpy
>     * Employee record.
>     *
>     * @(#)$Id: emprec.cpy,v 1.2 1999/11/12 01:16:41 $
>     *-------------------------------------------------------
>             02  emp-record.

>             04  emp-ssn                     pic 9(9) comp-3.

>             04  emp-name.
>                     06  emp-name-last       pic x(15).
>                     06  emp-name-first      pic x(15).
>                     06  emp-name-mi         pic x.

>             04  emp-addr.
>                     06  emp-addr-street     pic x(30).
>                     06  emp-addr-st         pic x(2).
>                     06  emp-addr-zip        pic x(9).

>     * End

Listing 2-2 XML Document Generated from eGen COBOL Copybook Utility (emprec.xml)

>     <emprec>
>        <empRecord>
>          <empSsn>660337645</empSsn>
>          <empName>
>            <empNameLast>Purebred</empNameLast>
>            <empNameFirst>Polly</empNameFirst>
>            <empNameMi>P</empNameMi>
>          </empName>
>          <empAddr>
>            <empAddrStreet>3235 Possum Park Ln.</empAddrStreet>
>            <empAddrSt>TX</empAddrSt>
>            <empAddrZip>758050000</empAddrZip>
>          </empAddr>
>        </empRecord>
>     </emprec>

Listing 2-3 XML Schema Generated from eGen COBOL Copybook Utility (emprec.xsd)

>     <?xml version="1.0"?>
>     <schema
>        xmlns:xsd="http://www.w3.org/1999/XMLSchema">

>       <xsd:annotation>
>         <xsd:documentation>
>           Schema:       emprec
>           Version:      1.0
>           Source:       ../symbol/emprec.cpy
>           Generated:    2000-09-27T19:19:42.857Z
>           Created:      2000-09-27T19:19:43.708Z
>           Modified:     1999-11-12T01:16:41.000Z
>         </xsd:documentation>
>       </xsd:annotation>

>       <xsd:element name="emprec">
>         <xsd:complexType>

>           <xsd:attribute name="date"
>              type="xsd:timeInstant"/>

>           <xsd:attribute name="version"
>              type="xsd:string"
>              use="default"
>              value="1.0"/>

>           <xsd:element name="empRecord">
>             <xsd:complexType>

>               <xsd:element name="empSsn">
>                 <xsd:simpleType base="xsd:integer">
>                   <xsd:precision value="9"/>
>                   <xsd:minInclusive value="0">
>                 </xsd:simpleType>
>                 <!-- <%picture value="9(9)"/> -->
>               </xsd:element>

>               <xsd:element name="empName">
>                 <xsd:complexType>

>                   <xsd:element name="empNameLast"
>                      type="xsd:string"
>                      length="15"/>
>                      <!-- <%picture value="x(15)"/> -->

>                   <xsd:element name="empNameFirst"
>                      type="xsd:string"
>                      length="15"/>
>                      <!-- <%picture value="x(15)"/> -->

>                   <xsd:element name="empNameMi"
>                      type="xsd:string"
>                      length="1"/>
>                      <!-- <%picture value="x"/> -->

>                 </xsd:complexType>
>               </xsd:element> <!--"empName"-->

>               <xsd:element name="empAddr">
>                 <xsd:complexType>

>                   <xsd:element name="empAddrStreet"
>                      type="xsd:string"
>                      length="30"/>
>                      <!-- <%picture value="x(30)"/> -->

>                   <xsd:element name="empAddrSt"
>                      type="xsd:string"
>                      length="2"/>
>                      <!-- <%picture value="x(2)"/> -->

>                   <xsd:element name="empAddrZip"
>                      type="xsd:string"
>                      length="9"/>
>                      <!-- <%picture value="x(9)"/> -->

>                 </xsd:complexType>
>               </xsd:element> <!--"empAddr"-->

>             </xsd:complexType>
>           </xsd:element> <!--"empRecord"-->

>         </xsd:complexType>
>       </xsd:element> <!--"emprec"-->

>     </schema>

Listing 2-4 DTD Generated from eGen COBOL Copybook Utility (emprec.dtd)

>     <!--
>     ! DTD emprec 1.0
>     !
>     ! Definition:   emprec
>     ! Version:      1.0
>     ! Source:       ../symbol/emprec.cpy
>     ! Generated:    2000-09-27T19:18:25.084Z
>     ! Created:      2000-09-27T19:18:24.937Z
>     ! Modified:     1999-11-12T01:16:41.000Z
>     !-->

>     <!ELEMENT emprec
>      ( empRecord )>

>     <!ATTLIST emprec
>       date CDATA #DEFAULT "unknown">
>       <!-- format="ccyy-mm-ddThh:mm:ss.mmmZ" -->

>     <!ATTLIST emprec
>       version CDATA #DEFAULT "1.0">

>     <!-- empRecord -->
>     <!ELEMENT empRecord
>      ( empSsn ,
>        empName ,
>        empAddr )>

>     <!-- empRecord.empSsn -->
>     <!ELEMENT empSsn
>       (#PCDATA)>

>     <!-- empRecord.empName -->
>     <!ELEMENT empName
>      ( empNameLast ,
>        empNameFirst ,
>        empNameMi )>

>     <!-- empRecord.empName.empNameLast -->
>     <!ELEMENT empNameLast
>       (#PCDATA)>

>     <!-- empRecord.empName.empNameFirst -->
>     <!ELEMENT empNameFirst
>       (#PCDATA)>

>     <!-- empRecord.empName.empNameMi -->
>     <!ELEMENT empNameMi
>       (#PCDATA)>

>     <!-- empRecord.empAddr -->
>     <!ELEMENT empAddr
>      ( empAddrStreet ,
>        empAddrSt ,
>        empAddrZip )>

>     <!-- empRecord.empAddr.empAddrStreet -->
>     <!ELEMENT empAddrStreet
>       (#PCDATA)>

>     <!-- empRecord.empAddr.empAddrSt -->
>     <!ELEMENT empAddrSt
>       (#PCDATA)>

>     <!-- empRecord.empAddr.empAddrZip -->
>     <!ELEMENT empAddrZip
>       (#PCDATA)>

>     <!-- End -->

Copyright © 2001 BEA Systems, Inc. All rights reserved. Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher.