The XML2Text component transforms data from XML format to flat file format. This component accepts data in XML format and transforms it into the required Text (delimited, positional or both) format.
Configuration and Testing
Managed Connection Factory
Figure 1: Managed Configuration Properties
Attributes
File 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 the ellipsis button.
Connection Pool Params
Please refer Connection Pool Params section in Common Configurations page.
Interaction Configuration
Prefix namespace for only root element
The schema generated will have element form default as unqualified and the child elements will belong to the namespace of root element, otherwise each element will have its own namespace prefix.
Target Namespace
Refer to the Target Namespace section under the Common Configurations page.
Monitoring Configuration
Please refer to the Monitoring Configuration section in Common Configurations page.
Expert Properties
Enable the Expert Properties view to configure these properties.
Figure 10: XML2Text CPS with the Expert Properties enabled and highlighted
Pre Processing XSL Configuration
Pre Processing XSL configuration can be used to transform request message before processing it. Click the ellipses button against the property to configure the properties.
Refer to the Pre/Post Processing XSL Configuration section under the Common Configurations page for details regarding Pre Processing XSL configuration and Post Processing XSL configuration (below).
Post Processing XSL Configuration
Post Processing XSL configuration can be used to transform the response message before sending it to the output port.
Process Message Based on Property
The property helps components to skip certain messages from processing.
Refer to the Process Message Based On a Property section under the Common Configurations page.
Validate Input
If this property is enabled, it validates the input request with the input port XSD.
Refer to the Validate Input section under the Common Configurations page.
Cleanup resources (excluding connection) after each document
This closes all the resources except for the connection after every request. If the less processing time is more important the less memory usage, then it is recommended to disable this property and vice versa.
For more details, refer to the respective section under in the Common Configurations page.
Elements to Decrypt
Select elements to decrypt in the Input Message.
Refer to the Encrypt Decrypt Configuration section in the Common Configurations page for details.
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 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 Schema Format
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.