How to properly define schemas

I realize the subject is a bit nebulous, but bear with me.

 

I am coming from the world of a COBOL suit (20+ years) where I am used
to different name for the various things in the XML world.  I am trying
to create a mental map to fit (or perhaps cram) my COBOL concepts onto
XML.

 

The first mapping I am making is of FD (File Definitions) onto XSD.  As
I see it, the XSD is functionally equivalent to the FD in that it
defines the structure of the information contained in the XML document.
It enhances the FD concept in that it encapsulates some validation and
restriction rules that are not available in COBOL (In COBOL I am limited
to three basic data types: Numeric, Alphanumeric and Alphabetic).

 

Now my question comes in at converting a simple COBOL application to
using the XML tools.

 

Let us say I have a program that prints a purchase order (PO).  The PO
is actually made up of two files: header and detail.  The header file
contains information common to all of the detail lines for a PO, while
the detail file contains the variable details.

 

PO Header (in XML)

 

<PurchaseOrderHeader>

            <POH>

                        <PO_number>1</PO_number>

                        <PO_source>General Supply</PO_source>

                        <PO_duedate>2002-12-22</PO_duedate>

            </POH>

</PurchaseOrderHeader>

 

<PurchaseOrderDetails>

            <POD>

                        <PO_number>1</PO_number>

                        <PO_line>1</PO_line>

                        <PO_item>Widget</PO_item>

                        <PO_quantity>1</PO_quantity>

                        <PO_price>12.23</PO_price>

            </POD>

            <POD>

                        <PO_number>1</PO_number>

                        <PO_line>2</PO_line>

                        <PO_item>Gadget</PO_item>

                        <PO_quantity>12</PO_quantity>

                        <PO_price>11.34</PO_price>

            </POD>

</PurchaseOrderDetails>

 

Each of these, in COBOL, is a separate file.  These files are related to
each other by <PO_number/>.  Is there a best practice for defining the
XSD for each of these documents to make the relationship as easy to use
as possible, keeping in mind that something like XSL will be used to
transform the documents into a printable form?  How are one-to-one,
one-to-many, many-to-one and many-to-many relationships best dealt with?

--
boris@kortiak.com
 <http://www.boriskortiak.com/> http://www.boriskortiak.com/

 

Received on Friday, 25 October 2002 06:21:41 UTC