The Text2XML component transforms data from any flat file format to XML format. This component accepts data in Text (Delimited, Positional or both) format and transforms it into the required XML format.
Configuration and Testing
Managed Connection Factory
Figure 1: Managed Connection Factory Panel
Attributes
Flat Format Schema content
Flat Format Schema Content (TFL file), which describes the conversion rules has to be specified here. The TFL schema file can be provided using 'Flat Format Schema Content editor' which opens up on clicking ellipsis button against this property.
Figure 2: Flat Format Schema Content editor
Connection Pool Params
Please refer Connection Pool Params section in Common Configurations page.
Interaction Configuration
Figure 3: Interaction Configurations Panel
Attributes
Enable dos2unix conversion?
This property should be used when CRLF (0D0A) should be converted to LF (0A) before processing the input message. New line is treated as CRLF (0D0A) in Windows and LF (0A) in Unix.
If the TFL file contains delimiter as new line character and whether the flat file is generated in Windows or Unix is not known, this property should be set to 'yes'. If this property is set to 'yes', the component converts all CRLF's to LF's in the input flat file and TFL file and then it applies the conversion rules specified in the TFL file.
The transformation may be tested by clicking the Test button in the Interaction Configuration panel. Sample message is generated depending on the Flat Format schema provided in the Managed Connection Factory panel.
First Line as Field Names?
Enable this to consider the first line as the name of fields.
Elements to Encrypt
Select the elements to encrypt in output. Elements in the Input Message will be decrypted and those in Output Message will be encrypted.
Scheduler Configurations
Please refer the respective section in Common Configurations page.
Transport Configurations
Please refer the respective section in Common Configurations page.
Error Handling
Please refer the sections Request Processing Error, Connection Error and Invalid Request Error in the Error Handling section of Common Configurations page for details.
Testing
Schema
Sample CSV File Format Schema is shown in the figure below.
Figure 4: Sample CSV File Format Schema
The structure of the schema is shown in the figure below. Sample schema contains Employee records and each record contains EmployeeName, EmployeeID and EmployeeAge fields. This sample schema has Record Delimiter CRLF and Field Delimiter comma (,).
Figure 5: Structure of Sample CSV File Format Schema
Sample Input
Sample Input contains CSV formated Employee Records, which are separated by a new line character and the fields are separated by comma. Sample Input is shown in the figure below.
Figure 6: Sample Input
Output
Ouput generated for the sample input is shown in the figure below. The output XML structure is same as the structure of CSV File Format Schema.
Figure 7: Sample Output
Functional Demonstration
Scenario 1
The scenario demonstrates the transformation of comma-separated values into XML.
Configure the Text2XML component as described in Configuration and Testing section and use Feeder and Display components to send sample input and check response respectively. CSV File Format Schema is used in this scenario.
Figure 8: Demonstrating Scenario 1 with sample input and output
Use Case Scenario
In Bond Trading sample event process, Text2XML component is used to convert the data from CSV format to XML format.
The event process demonstrating this scenario is bundled with the installer. Documentation of the scenario and instructions to run the flow can be found in the Help tab of the flow in eStudio.
Useful Tips
Please refer Flat File Schema Editor section for the documentation related to creating the Text Format Layout (TFL) files.