Command "ReadCSV"

Summary

Reads the content of a CSV (comma separated value) file into an XML structure (document). The name of the root-element will be 'csvroot' containing n elements named 'csvrow' for each row. The command belongs to the group "Document".


Parameters

Parameter Name Description Type
AttrNames A comma-sperated list containing the names of the attributes in the correct order. Leave it empty if you want to use the header-row! valueexpression
FileName The path and name of the CSV-file. valueexpression
Header To indicate whether the first line of the CSV-file contains the names of the attributes ('true' or 'false'). Can also be used if your CSV file contains a header row, but you want to define other attribute-names. valueexpression
NewDocRef The name of the reference under which the created XML-structure will be accessible. saveDocumentReference
Separator The string used as separator in the CSV-file. If you don't enter a value here, the default will be ','. valueexpression

Valid parameter combinations



Description

Reads in a CSV file and add it to the XML node specified. The root element will be called "csvroot" containing n "csvrow" elements one for each row of the csv file.

Examples


Example 1

The CSV file to be read looks like...

Donald;Duck;0041001
Tick;Duck;0041002
Trick;Duck;0041003
Track;Duck;0041004
Dagobert;Duck;0041099

The following command reads the above CSV file in and adds it to the XML node "address".
<ReadCSV AttrNames="firstname,lastname,phone" FileName="address.csv" Header="false" NewDocRef="$address" Separator=";"/>