CSV-XML/XML-CSV Adapter
Usage
The CSV-XML/XML-CSV Adapter converts inbound CSV messages to XML messages, and XML to CSV:
-
CSV > XML
Use this option to convert CSV messages to a standard XML format, such as xCBL or BMEcat when a workflow is being processed with XSLT.
CSV Adapter modules accept CSV data only if it follows the RFC4180 standard. Refer to RFC4180.
-
XML > CSV
To convert data from an XML format to a CSV format. The expected XML input format is a flat XML format containing the individual records to be converted. You can create this XML format using an XSLT Converter module.
Example: XML to CSV Conversion
Prerequisites
You have prepared an XML structure provided by an XSLT Converter or an XML file, e.g.:
Proceed as follows
-
Open the workflow that contains the XML-CSV Adapter for editing.
-
Open the XML-CSV Adapter for editing.
-
Enter the XML root element based on the XML structure representing the input data.
-
Enter the segment name from the XML structure representing the input data.
-
Import the field names from the XML file, from a CSV file, or enter the field names manually corresponding to the expected XML structure.
→ The Module Editor wizards page of the XML-CSV Adapter should look like this.
-
Publish the module and the workflow.
-
Set the start point at the appropriate module, e.g. the XML-CSV Adapter and load the test file.
→ After the workflow has been executed successfully, the output message should look like this:
Dialog Module Editor in the CSV-XML/XML-CSV Adapter
-
XML root element
The root element identifier of the XML document for both the input and the output file, such as
<Invoice>
. -
Segment name
The segment name is added to the XML tag enclosing the individual attribute tags, such as
<Item>
, in the XML document read or created by the Format Adapter. -
Text qualifier
This string encloses the values in a record that are marked/to be marked as text.
-
Field names
In some CSV formats, the individual field attribute names are located in the first line of the CSV file. If this is the case for your CSV format, enable this selection box.
-
Ignore overlapping fields/Ignore missing fields
(Only for CSV>XML)
Enables parsing of non-CSV-compliant messages.
-
Fixed length columns
(Only for XML>CSV)
For each field type its maximum length is calculated. All other fields of the same type are filled up with blanks until the maximum length is reached.
-
Field delimiter
This string separates individual values in a record in the source message.
-
Record delimiter
Enabled for XML>CSV conversion only.
For CSV>XML conversion, use
\n
as the record delimiter. If the character for record delimiters is used in the data, it must be escaped by a backslash (\
) or enclosed by two exclamation marks (!!
). -
Record delimiter at end of file
Can only be selected for XML>CSV adapters.
-
Character encoding (CSV)
Specifies the character set in which the the CSV data is/shall be encoded. By default, the ISO‑8859-1 character set is used. It contains all characters of the common Western European languages, including their special characters. You can select or enter a different character set.
-
Field names from CSV file
To import field names from a CSV file stored in the file system.
Define both the field and the record delimiter as in the file you are converting. This is true for both the input message and the output message.
-
Field names from XML file
To import field names from an XML file stored in the file system.
The entries in the XML root tag and Segment name fields must match the names of the
root
element and thesegment
element in the XML file you are converting. This is true for both the input message and the output message. -
Table with the names of adapter fields
Displays the field names imported from a CSV file or an XML file. You can add, delete, or ignore table rows using the table context menu.
Table actions
In the table you can enter names of adapter fields. By right-clicking into a row, further actions can be executed:
-
Insert row above
Adds a row above the currently selected row.
-
Insert row below
Adds a row below the currently selected row.
-
Delete row
Deletes the currently selected row.
-
Ignore row
Skips the currently selected row when analyzing.