Search This Blog

Friday, 18 January 2013

Understanding XML and identifying Groups of repeating elements


Understanding XML and identifying Groups of repeating elements

 Defining Groups

By defining a group, you are notifying XML Publisher that for each occurrence of an element, you want the included fields displayed. At runtime, XML Publisher will loop through the occurrences of the element and display the fields each time.
In the example, for each occurrence of G_VENDOR_NAME in the XML file, we want the template to display its child elements VENDOR_NAME (Supplier Name), G_INVOICE_NUM (the Invoices group), Total Entered Amount, and Total Accounted Amount. And, for each occurrence of G_INVOICE_NUM (Invoices group), we want the template to display Invoice Date, PAYMENT_METHOD_LOOKUP_CODE, SET_OF_BOOKS_ID, APPROVED_AMOUNT To designate a group of repeating fields, insert the grouping tags around the elements to repeat. Insert the following tag before the first element:
<?for-each:XML group element tag name?>
Insert the following tag after the final element:
<?end for-each?>
Grouping scenarios
Note that the group element must be a parent of the repeating elements in the XML input file.
·         If you insert the grouping tags around text or formatting elements, the text and formatting elements between the group tags will be repeated.
·         If you insert the tags around a table, the table will be repeated.
·         If you insert the tags around text in a table cell, the text in the table cell between the tags will be repeated.
·         If you insert the tags around two different table cells, but in the same table row, the single row will be repeated.
·         If you insert the tags around two different table rows, the rows between the tags will be repeated (this does not include the row that contains the "end group" tag).

Our data model looks like

Query we had used for creating data model is shown below
SQL>SELECT pov.vendor_name, 
               ai.invoice_date, 
               ai.invoice_amount,
               ai.payment_method_lookup_code, 
               ai.set_of_books_id, 
              ai.approved_amount
  FROM po_vendors pov, ap_invoices_all ai
 WHERE pov.vendor_id = ai.vendor_id;

Now we have to generate XML which we had learnt in previous lesson


Save the XML file in appropriate location which is used to load data in RTF.

Now we have to construct RTF

No comments:

Post a Comment