Example of Printing XML Data with a Page Definition
Figure XML Data shows the XML data to be printed.
XML Data
<customer type='Home'> <name> <first>Justin</first> <last>Case</last> </name> <address> <strno>123</strno> <street>Redlight Lane</street> <city>Twistnshout</city> <state>MAMassachusetts</state> <zip>01050</zip> </address> </customer> <customer type='Work'> <name> <first>Anna</first> <last>Merkin</last> </name> <address> <strno>1911</strno> <street>Colt Lane</street> <city>Longmont</city> <state>COColorado</state> <zip>80501</zip> </address> </customer>
Figure Page Definition shows the page definition.
Page Definition
SETUNITS 1 IN 1 IN LINESP 6 LPI; Pagedef XMLxml replace yes UDType EBCDIC; FONT E21H0C TYPE EBCDIC; DEFINE cust QTAG 'customer'; DEFINE name QTAG 'customer','name'; DEFINE fname QTAG 'customer','name','first'; DEFINE lname QTAG 'customer','name','last'; DEFINE addr QTAG 'customer','address'; DEFINE strno QTAG 'customer','address','strno'; DEFINE street QTAG 'customer','address','street'; DEFINE city QTAG 'customer','address','city'; DEFINE state QTAG 'customer','address','state'; DEFINE zip QTAG 'customer','address','zip'; XLAYOUT cust POSITION ABSOLUTE 0 FIELD ATTR 'type' ; FIELD TEXT ' customer:' ; XLAYOUT fname POSITION ABSOLUTE 2.5 SAME; XLAYOUT lname POSITION RELATIVE 0.167 SAME; XLAYOUT strno POSITION ABSOLUTE 5.5 SAME; XLAYOUT street POSITION RELATIVE 0 SAME; FIELD TEXT ' ' ; FIELD START 1 LENGTH *; XLAYOUT city POSITION ABSOLUTE 5.5 NEXT; FIELD START 1 LENGTH *; FIELD TEXT ', '; XLAYOUT state POSITION RELATIVE 0 SAME; FIELD START 1 LENGTH 2; FIELD TEXT ' '; XLAYOUT zip POSITION RELATIVE 0 SAME;