XML Data Element Example

An application can group XML data elements to be formatted together as an entity by grouping those elements hierarchically under a collection XML data element. The data order normally does not matter in formatting the data elements unless the elements are to be placed relative to each other in the inline direction. Any elements to be placed inline relative to each other must be ordered in inline presentation order. Use the XLAYOUT/FIELD commands to place the data on the presentation device. Figure XML Data Elements is an example of a bank customer showing the name and address fields placed together:

XML Data Elements

<Customer>
  <name>
    <title>Dr.</title>
    <first>Kelly</first>
    <last>Green</last>
  </name>
  <address>
    <strno>1911</strno>
    <street>Colt Lane</street>
    <city>Longmont</city>
    <state>CO</state>
    <zip>80501</zip>
  </address>
</Customer>

The example in Figure XML Data Elements results in the following printed output:

Dr. Kelly Green
1911 Colt Lane
Longmont, CO 80501

The page definition used to create the output is as follows:

PAGEDEF xmp101 UDTYPE ebcdic REPLACE yes;
/*------------------------------------------------------*/
/* Font definitions:
/*------------------------------------------------------*/
FONT E21H0C TYPE EBCDIC;

/*------------------------------------------------------*/
/* Use QTAG definitions to define short alias names     */
/* that make coding the XLAYOUTs easier. Do the         */
/* messy work here, allowing us to code on the XLAYOUT: */
/*  XLAYOUT zip …                                     */
/* instead of:                                          */
/*  XLAYOUT QTAG 'Customer','address','zip' …         */
/*------------------------------------------------------*/
Define cust   QTAG 'Customer'                ;
Define title  QTAG 'Customer','name' ,'title';
Define first  QTAG 'Cu