bea.com | products | dev2dev | support | askBEA
 Download Docs 
 Search 

Programming Guide

 Previous Next Contents Index View as PDF  

Understanding How WebLogic JAM Uses XML

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

This section discusses the following topics:

 


What is XML?

Extensible 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.

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  C-3 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  C-4 for an example XML Schema document.

 


How WebLogic JAM Uses XML

The WebLogic JAM eGen Application Generator provides the ability to generate both XML Schema and XML DTD (Document Type Definition) documents for a given COBOL copybook record definition. The WebLogic JAM runtime environment provides the capability of converting data records into XML data documents formatted according to their corresponding schema or DTD definitions.

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

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

Listing C-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 C-2 Example XML Document that Conforms to a DTD and XML Schema Generated from the eGen Application Generator (emprec.xml)

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

Listing C-3 DTD Generated from eGen Application Generator (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 -->

Listing C-4 XML Schema Generated from eGen Application Generator (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>

 

Back to Top Previous Next