Associate the XML Data to the Template Layout

The figure in this section shows a sample layout for a Payables Invoice Register.

Note the following:

  • The data fields that are defined on the template.

    For example: Supplier, Invoice Number, and Invoice Date

  • The elements of the template that are repeated when the report is run.

    For example, all the fields on the template are repeated for each Supplier that is reported. Each row of the invoice table is repeated for each invoice that is reported.

Use an XML Input File

Following is the XML file that is used as input to the Payables Invoice Register report template.

To simplify the example, the XML output shown has been modified from the actual output from the Payables report.

<?xml version="1.0" encoding="WINDOWS-1252" ?>
    -  <G_INVOICE_NUM>

XML files are composed of elements. Each tag set is an element. For example <INVOICE_DATE> </INVOICE_DATE> is the invoice date element. "INVOICE_DATE" is the tag name. The data between the tags is the value of the element. For example, the value of INVOICE_DATE is "10-NOV-03".

The elements of the XML file have a hierarchical structure. Another way of saying this is that the elements have parent-child relationships. In the XML sample, some elements are contained within the tags of another element. The containing element is the parent and the included elements are its children.

Every XML file has only one root element that contains all the other elements. In this example, VENDOR_REPORT is the root element. The elements LIST_G_VENDOR_NAME, ACCTD_SUM_REP, and ENT_SUM_REP are contained between the VENDOR_REPORT tags and are children of VENDOR_REPORT. Each child element can have child elements of its own.

Identify Placeholders and Groups

The template content and layout must correspond to the content and hierarchy of the input XML file. Each data field in the template must map to an element in the XML file. Each group of repeating elements in the template must correspond to a parent-child relationship in the XML file.

Define placeholders to map the data fields. Define groups to designate the repeating elements.


Publisher supports regrouping of data if the report requires grouping that doesn't follow the hierarchy of the incoming XML data. For information on using this feature, see Regroup the XML Data.

Use Placeholders

Each data field in the report template must correspond to an element in the XML file.

When you mark up the template design, you define placeholders for the XML elements. The placeholder maps the template report field to the XML element. At runtime the placeholder is replaced by the value of the element of the same name in the XML data file.

For example, the "Supplier" field from the sample report layout corresponds to the XML element VENDOR_NAME. When you mark up the template, you create a placeholder for VENDOR_NAME in the position of the Supplier field. At runtime, this placeholder is replaced by the value of the element from the XML file (the value in the sample file is COMPANY A).

Identify the Groups of Repeating Elements

The sample report lists suppliers and their invoices. There're fields that repeat for each supplier and invoice.

The report therefore consists of two groups of repeating fields:

  • Fields that repeat for each supplier

  • Fields that repeat for each invoice

The invoices group is nested inside the suppliers group. This can be represented as follows:


  • Supplier Name

  • Invoices

    • Invoice Num

    • Invoice Date

    • GL Date

    • Currency

    • Entered Amount

    • Accounted Amount

  • Total Entered Amount

  • Total Accounted Amount

Compare this structure to the hierarchy of the XML input file. The fields that belong to the Suppliers group shown above are children of the element G_VENDOR_NAME. The fields that belong to the Invoices group are children of the element G_INVOICE_NUM.

By defining a group, you're notifying Publisher that for each occurrence of an element (parent), you want the included fields (children) displayed. At runtime, Publisher loops through the occurrences of the element and displays the fields each time.