Skip to main content
Skip table of contents

CSV Converter from URL

This adapter reads a CSV text document (comma separated values) from any URL and outputs an XML document with UTF-8 character encoding and with element names that can refer to the column names.

Lines before the actual beginning of CSV data rows can be omitted as well as comment lines. Both CR (carriage return) and CRLF (carriage return line feed) will be interpreted as line breaks. Using the operation Iterate, the adapter can iterate through the input document and output a result document for each iteration within the Technical Process.

Properties

Operation

Defines the operation executed by the function adapter

Possible values:

  • Parse: Read CSV text document in one step

  • Iterate: Read CSV text document iterative

  • Clear: Reset the iterator of a CSV Converter form URL having the same ID as the corresponding CSV Converter from URL with the operation Iterate (see parameter id)

Parameters

Adapter

Main adapter class (Do not change!)

Possible values: de.softproject.integration.adapter.csv.CsvAdapter: Main class (default)

start

First data row to be read (counting starts with 0; if the CSV file contains a header row, it will be omitted)

Possible values:

  • Positive integer

  • 0: Read from the first line (Default)

count

Number of rows to be read (with operation Iterate for each iteration)

Possible values:

  • Positive integer

  • 0: No limitation, e.g. read all rows at once (default)

id

Unique ID of the CSV Converter from URL component within the process context or the process instance (if you want to use multiple independently iterating CSV Converters from URL within the same process context)

Possible values:

  • 0: Use current action ID (process action number) as ID; Please note that another CSV Converter from URL in a subprocess could have the same action ID. (Default)

  • Any integer number except 0 to uniquely identify the corresponding CSV Converter from URL component within the process context; Recommendation: use a value >1000 to avoid catching an already existing action ID accidentally.

columnNamesInFirstRow

Interpret data fields in the CSV text file's first row as column headers and name the data field elements within the XML document correspondingly, if the values are valid XML names

Possible values:

  • Enabled: The first row of the CSV text document contains column headers that are applicable as valid XML element names (without namespace declarations).

  • Disabled: The CSV text document contains only data rows; data elements will be named <Column> or <Column_n> (if the parameter useIndexedColumns has been enabled). (Default)

normalizeHeaderNames

Defines how headers should be normalized if they contain characters that are not XML-compliant, such as spaces or special characters.

Possible values:

  • Special element name (default): Do not normalize header name, but replace it with <Column> (Ex: author book<column>)
  • Skip non compliant characters: Skip non-XML characters (Ex: author book → <authorbook>)
  • Replace with dash: Replace non-XML characters with - (Ex: author book → <author-book>)
  • Replace with underscore: Replace non-XML characters with _ (Ex: author book → <author_book>)
columnNamesAfterStart

Interpret values from the row defined within the parameter start as column headers, and name the data field elements within the XML document correspondingly, if the values are valid XML names

Possible values:

  • Enabled: Ignore skipped rows and use column headers from the first processed row

  • Disabled: The first processed row doesn't contain column headers; data elements will be named <Column> or <Column_n> (if the parameter useIndexedColumns has been enabled). (Default)

delimiter

Delimiter character between the fields of a record in the CSV text document

Possible values:

  • Any character (no escape sequences such as \t

  • ;: Semicolon (default)

rowName

Element name in the output XML document that wraps each data row

Possible values: XML element name (without namespace)

excel

Defines if the processed CSV text document has been exported from MS Excel (not a standard CSV format) and if the adapter must convert it

Possible values:

  • Enabled: Process a CSV text document in the MS Excel CSV format

  • Disabled: Process a standard CSV text document (Default)

useIndexedColumns

Add column numbers (starting with 0) to data element names, if no column headers are available

Possible values:

  • Enabled: Append actual column number to the data element name (e.g. <Column_0>)

  • Disabled: All data elements will be named <Column> (Default)

commentStart

Prefix string to indicate comment lines; Matching lines will be omitted.

Possible values:

  • Any string (except delimiter or quoting characters) (e.g. ****)

  • (empty): No comment handling; Lines will be interpreted as data rows. (Default)

inputEncoding

Character encoding of the input

Possible values:

  • Any valid character encoding (e.g. UTF-8)

  • (empty): Use default encoding of the runtime environment

url

URL of the CSV text document to be read

Possible values:

Valid URL (e.g. xstore://Project/Folder/File.csv)

encoding

Character encoding of the CSV text document

Possible values:

  • Any valid character encoding (e.g. UTF-8)

  • (empty): Use default encoding of the runtime environment

Status values

-1

An error occurred during the adapter's execution (for details see server log).

0

The adapter doesn't output data (anymore). When using the operation Iterate, this status can be used as stop criterion of a loop within the Technical Process and it indicates that no further data row is available.

1

The adapter outputs a result document. When using the operation Iterate, this status can be used as condition to enter a loop within the Technical Process and it indicates that another data row is available.

Input

The adapter expects any structured CSV text file (that might be generated by MS Excel) with any delimiter character and with optional comment lines.

Output

This adapter outputs a UTF-8-encoded XML document with the following structure. For each processed line an element will be generated that has a name specified within the parameter rowName:

HTML/XML
<Csv>
    <!-- If column names are copied -->
    <Elementname rowNo="row number in the input">
        <Columnname>value</Columnname>
        <!--...-->
    </Elementname>
    <!-- If no column names are available -->
    <Elementname rowNo="column number in the input">
        <Column>value</Column>
        <!--...-->
    </Elementname>
    <!-- If no column names are available and parameter 'useIndexedColumns' is enabled -->
    <Elementname rowNo="row number in the output">
        <Column_Columnnumber>value</Column_Columnnumber>
        <!--...-->
    </Elementname>
</Csv>


Example

A CSV text file with comments is processed that contains column headers only in the second line, for instance:

HTML/XML
**** This line is just a comment and should not be processed. **** "METADATA","Value 1","Value 2","Value 3","Value 4","Value 5" "CustomerID","CompanyName","ContactName","ContactTitle","Address","PostalCode" "ALFKI","Alfreds Futterkiste","Maria Anders","Sales","Obere Str. 57","12209" **** This line is just a comment and should not be processed. **** "ANTON","Moreno Taquería","Antonio Moreno","Owner","Mataderos 2312","05023"

This requires to enable the adapter parameter columnNamesAfterStart, and to set the parameter start to 1 because both comment line and column header line won't be counted. When using the value Dataset for the parameter rowName, the following XML document will be generated:

HTML/XML
<Csv>
    <Dataset rowNo="2">
        <CustomerID>ALFKI</CustomerID>
        <CompanyName>Alfreds Futterkiste</CompanyName>
        <ContactName>Maria Anders</ContactName>
        <ContactTitle>Sales</ContactTitle>
        <Address>Obere Str. 57</Address>
        <PostalCode>12209</PostalCode>
    </Dataset>
    <Dataset rowNo="3">
        <CustomerID>ANTON</CustomerID>
        <CompanyName>Moreno Taquería</CompanyName>
        <ContactName>Antonio Moreno</ContactName>
        <ContactTitle>Owner</ContactTitle>
        <Address>Mataderos 2312</Address>
        <PostalCode>05023</PostalCode>
    </Dataset>
</Csv>
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.