Generating XML Output

An SQR program that generates XML output contains XML tags, which describe the data. You use the XML commands to generate XML output.

To generate XML output from an SQR program, you must:

  1. Define the structure or template of the XML to be generated. Use DEFINE-XML-TEMPLATE command to define the template.

    You also can create nested XML by adding one template to another. The definition of the child template should precede that of the parent template.

  2. Create XML-RECORD to define the XML template. To create XML-RECORD, you must specify the data. Each template will have an XML-RECORD to add data. This data is created in memory before being written to a disk.

    If XML templates are nested, you must add child XML-RECORDs before you add the parent XML-RECORD. Multiple child records can be added to a parent record by repeatedly adding child XML-RECORDs.

    Note: Ensure that child XML-RECORDs are not duplicated..

  3. Write the XML records to a disk and use WRITE_TO_XML_FILE to write the XML records to an XML output file.

    Note: The system clears the parent template automatically after the XML records are written, but you must clear the child templates manually.

Note: XML output format is not applicable for any of the existing reports that are shipped. Only new SQRs or ones modified with the new commands will generate an XML file.