XML Data Files
Data that is to be combined with a form is specified in XML format. A typical XML data file looks like this:
<?xml version="1.0" encoding="UTF-8"?> <XmlData> <Document> <ChargeTo> <Name>TONY BLUE</Name> <Addr1>1/44 GREEN ST</Addr1> <Addr2>YELLOWTOWN 3135</Addr2> </ChargeTo> <Header> <Invoice>10026645</Invoice> <Date>19MAR2010</Date> <SalesPerson>3</SalesPerson> <AccountNum>001327</AccountNum> </Header> <DetailLines> <LineItem> <ItemCode>F/GW712</ItemCode> <Desc>EXCELLENCE 7.5KG WASHER</Desc> <Qty>1</Qty> <Price>1089.00</Price> <Discount>NETT</Discount> <TAX>108.91 **</TAX> </LineItem> <LineItem> <ItemCode>F/ED56</ItemCode> <Desc>4.5KG S/S DRYER</Desc> <Qty>1</Qty> <Price>618.00</Price> <Discount>NETT</Discount> <TAX>61.24 **</TAX> </LineItem> <LineItem> <ItemCode>E/DS1100</ItemCode> <Desc>TURBO HEAD</Desc> <Qty>1</Qty> <Price>53.90</Price> <Discount>NETT</Discount> <TAX>0.00 **</TAX> </LineItem> </DetailLines> <Totals> <TotalPrice>$1760.90</TotalPrice> <TotalTAX>$174.50</TotalTAX> </Totals> </Document> <Document> a second set of data </Document> </XmlData>
Although the data stream may have many sets of data, Merge processes all the data between a <Document>
and </Document>
tag as a single document. Note that Merge ignores any tags and data not included between the <Document>
and tags. See also: -documentTag for setting a different document separator tag.
The XML tag names ("ChargeTo", "Name", "Header" and so on) must correspond to field names within the form. Design provides several features that enable a hierarchical structure to be created. For example, the form for this data file might include a group of data fields called "ChargeTo" that contains the fields "Name", "Addr1", and "Addr2". Merge will match the structure of the data to that of the form in order to correctly fill the data fields.
The general rule for merging data into a form is that the form design can have extra structural levels (e.g. groups and panes) but, to match, every structural level in the XML file must exist in the form design's structure.
Form | Data | |
---|---|---|
a.b.field | <a><b><field>xxx</field>... | match |
a.b.c.field | <a><c><field>xxx</field>... | match |
a.c.field | <a><b><c><field>xxx</field>... | no match |