An XML Format Example

The example in this section describes how to decode and encode XML data.

The example includes the following:

  • Workflow and Ultra configurations (ultra_xml_example.zip):

    • CSV_TO_XML_WF - Collects a CSV formatted file and converts it to XML. Optional fields that are not included in the CSV are populated in the workflow.

    • XML_TO_CSV_WF - Collects am XML formatted file and converts it to CSV. Optional fields in the XML are discarded.

    • ULTRA_CSV - CSV decoder and encoder.

    • ULTRA_XML - XML decoder and encoder.

  • Input data in CSV format (INFILE01.txt).
     

Follow these steps to run the example:

  1. Download the example files to /opt/ultraXML.

  2. Create the subdirectory indata in /opt/ultraXML.

  3. Copy INFILE01.txt to /opt/ultraXML/indata.

  4. Open the System Importer and select /opt/ultraXML/ultra_xml_example.zip. Import all configurations.

  5. Start the workflow CSV_TO_XML_WF. This creates an XML file based on the CSV input in the directory /opt/ultraXML/out.

  6. Copy the generated XML file to the directory /opt/UltraXML/indata.

  7. Start the workflow XML_TO_CSV_WF. A CSV file that is identical to the downloaded input file is created in /opt/ultraXML/out.

Below is a description of the Ultra configuration that is used for XML encoding and decoding.

Example - ULTRA_XML

To decode or encode XML data, a format definition (an XML Schema syntax) is included in Ultra xml_schema block.

Collected XML UDRs are often terminated by one or several whitespace characters. When mapping, the whitespace temporary record is identified. Although input data that includes trailing whitespace characters is valid in XML, it is recommended that you eliminate them when decoding the data. To remove any excessive white spaces from the XML UDRs, the external format WhiteSpace is used with the in_map of the decoder. For further information see In-maps and Decoders.

The internal and external formats can be mapped automatically but are mapped explicitly in the example. This is to demonstrate how the interpretation of XML types works.

To get rid of white spaces, create a <literal>in_map</literal> for the external format  WhiteSpace using the discard_output option. For further information, see the In-maps. 

To remove as many white spaces as possible from the processed data, WS_map is set first in the deocder.