The converter element enables you to transform an input message in one format to another.
Input:
123, Akshay, CPI Consultant
456, Akshada, Professor
CSV to XML Converter :
XML Schema:
Choose Browse and select the file path to the XML
schema file that is used as the basis for message transformation. The XML file schema format is used as the
basis for creation of the payload.
Path to Target Element in XSD :
XPath in the XML Schema File where the content from
CSV has to be placed.
Record Marker in CSV :
The corresponding record in the CSV file that has to be
considered for conversion. This entry is the first text in
every new record of the CSV.
If this value is not specified then all the records
would be considered for conversion.
Field Separator :
If we want to use a field separator that is not available in the dropdown list, manually enter the
character in Field Separator in CSV field.
If you want to exclude headers in the first line of CSV file for conversion, select Exclude First Line
Header checkbox.
If the checkbox is not selected, then the attributes of the CSV file are mapped according to the order of occurrence in the XSD.
Path to Target Element in XSD :
CompetencyList/Competency
Output:
---------------------------------------------------------
<?xml version='1.0' encoding='UTF-8'?>
<CompetencyList>
<Competency>
<id>123</id>
<name> Akshay</name>
<description> CPI Consultant</description>
</Competency>
<Competency>
<id>456</id>
<name> Akshada</name>
<description> Professor</description>
</Competency>
</CompetencyList>
---------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------
XSD used:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created with Liquid Technologies Online Tools 1.0 (https://www.liquid-technologies.com) -->
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="CompetencyList">
<xs:complexType>
<xs:sequence>
<xs:element name="Competency">
<xs:complexType>
<xs:sequence>
<xs:element name="id" />
<xs:element name="name" />
<xs:element name="description" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
--------------------------------------------------------------------------------------------------------------------------
Important Points:
- If the CSV file has more fields then the XML schema fields , the converter will ignore the additional fields form the CSV
--------------------------------------------------------------------------------------------------------------------------
No comments:
Post a Comment