The XML2Text component transforms data from XML format to flat file format. This component accepts data in XML format and transforms it to the required Text (delimited, positional or both) format.
Configuration and Testing
Managed Connection Factory
Figure 1: Managed Configuration Properties
Attributes
For information about the below attributes, please refer to the respective sections mentioned below:
- File Format Schema content: MT2XML
- Connection Pool Params: Common Configurations
Interaction Configuration
Figure 2: Interaction Configurations Panel
Attributes
Prefix namespace for only root element
The schema generated will have elementformdefault as unqualified and the child elements will belong to the namespace of root element, otherwise each element will have its own namespace prefix.
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 as below.
Figure 3: Sample CSV Schema Format
The structure of the schema is shown the below figure. Sample schema contains Employee records and each record contains EmployeeName, EmployeeID and EmployeeAge fields. This sample schema has Record Delimiter as CRLF and Filed delimiter as comma(,).
Figure 4: Structure for the Sample CSV SchemaFormat
Sample Input
The input XML structure is same as that of the sample CSV file format schema which is shown in Figure 4.
Sample input is shown in the below figure. It contains multiple Employee elements under EmployeeSchema element. Each Employee element contains EmployeeName, EmployeeAge and EmployeeID elements.
Figure 5: Sample Input
Sample Output
Sample output contains CSV formated Employee Records, which are separated by new line character (CRLF) and the fields are separated by a comma (,).
Figure 6: Sample Output
Functional Demonstration
Scenario 1
This scenario demonstrates the transformation of XML into comma-separated values (CSV).
Configure the XML2Text component as described in the Testing section and use Feeder and Display components to send sample input and check the response respectively. CSV File Schema is used in this scenario.
Figure 7: Demonstrating Scenario 1 with sample input and output.
Useful Tips
Please refer Flat File Schema Editor section for the documentation related to creating the Text Format Layout (TFL) files.