XML Page Definition Formatting Function

The XML page definition formatting function allows an application to specify formatting instructions for XML data by specifying an XLAYOUT command with specific formatting instructions for the data. The XLAYOUT command addresses an XML data item by specifying a QTAG (qualified tag) for that data. A QTAG is a series of XML start tags that fully identify the XML data item. For example, in Figure XML Data Elements, for your customer's first name, the QTAG would be Customer, name, and first. To define a local name first for easy reference you could use the following DEFINE command:

  DEFINE first QTAG 'Customer','name','first';
and reference it with the following XLAYOUT command using the defined local name first:

Before printing the data, PSF scans the XML data item and matches it to an XLAYOUT command in the page definition by using its QTAG. The matching XLAYOUT command in the page definition is used to position and format the associated XML data item and its attributes on the printed page.

The XML page definition function has the following new PPFA concepts:

Relative Inline Positioning:
Relative inline positioning places data relative to the current position. If you position a text field and then place the text, the end of the text becomes the new current position. Graphics, barcodes, objects, segments, and overlays do not change the current position after they are originally positioned. For example, if you position a line with a DRAWGRAPHIC LINE command, the new current position is the starting point of that line. The length of the graphic line does not change the current position.

There are several restrictions when using relative inline positioning:

  1. XLAYOUT commands with relative positioning cannot contain any of the following:
    • FIELD commands with inline positioning relative to the XLAYOUT (LPOS)
    • FIELD ATTR (attribute) with inline positioning relative to the XLAYOUT (LPOS)
    • FIELD commands with barcodes
    • DRAWGRAPHIC commands
    • OBJECT subcommands
    • SEGMENT subcommands
    • OVERLAY subcommands
  2. You can only use the SAME parameter for inline positioning on the XLAYOUT command when the previously used XLAYOUT command used absolute inline positioning.

Absolute Inline Positioning:
Allows absolute inline positioning on a FIELD command for specific placement of elements.
Attributes are Special FIELDs:
The attribute is identified by name and the data printed is from the attribute value or a portion of the attribute value and not from the element content.
  1. If a FIELD is used for presenting any piece of data on the XLAYOUT command, FIELD commands must be used for all pieces of data presented on the XLAYOUT command. Since an attribute is a special field, if you want to print both an attribute value and the element data you need to code the attribute field for the attribute value and a regular field for the element data.
  2. PSF suppresses leading and trailing blanks (X'40' for EBCDIC or X'20' for ASCII) in the data. Multiple embedded blanks are reduced to one blank.