Exploring the Comma Separated Value (CSV) sample

This topic explains how to create your own DFDL schema files to model CSV formatted data, and explains the structure of each DFDL schema file that is used in the CSV sample.

Creating a DFDL schema file to model CSV formatted data

To create a DFDL schema file to model CSV formatted data:

  1. Below your Integration project click New > Message Model.
  2. In the New Message Model wizard, select CSV text. Click Next.
  3. In the CSV text window, select Create a DFDL schema file using this wizard to guide you. Click Next.
  4. In the Project field, enter the name of your Integration project. In the DFDL schema file name field, enter a name for your DFDL schema file. By default, the DFDL schema file name field also sets the Message name, but can be changed. Click Next.
  5. Optionally, the next page of the wizard allows you to configure common CSV settings, including the end of line character, whether the first record is a header, and number of fields.
  6. Click Finish.

The DFDL schema editor opens, and your new DFDL schema file is displayed. Your DFDL schema file can be edited if required.
When creating a DFDL schema file from the New Message Model wizard, each element is given a default name. To rename an element in your DFDL schema file, double-click the element in the Name column, type the new name for the element, and press Enter.
By default, the type of every element is set to String. To change the type of an element, select the element, then click the Type column.

Sample Message CSV_1

The following diagram displays a DFDL schema file that models the simplest type of CSV message. The diagram identifies the key items in the CSV message, and shows the logical structure that is defined in the DFDL schema file.

Image that explains the structure of message CSV_1

You can view the logical and physical properties that are defined by the DFDL schema file, CSV_1, by selecting CSV_1.xsd from the Integration project, CSVSchemas. Note that the message contains a single element called customer which has maxOccurs set to unbounded.

Sample Message CSV_2

This DFDL schema file defines the same CSV message structure as CSV_1, and extends it with a header. The following diagram identifies the key items in the CSV message, and shows the logical structure that is defined in the DFDL schema file.

Image that explains the structure of message CSV_2

You can view the logical and physical properties that are defined by the DFDL schema, CSV_2, by selecting CSV_2.xsd from the Integration project, CSVSchemas.

Sample Message CSV_3

This DFDL schema file defines the same CSV message structure as CSV_2, and extends it by adding a choice under the customer element. This choice allows the repeating CSV data to contain different structures for each repeating element. The following diagram identifies the key items in the CSV message, and shows the logical structure that is defined in the DFDL schema file.

Image that explains the structure of message CSV_3

You can view the logical and physical properties that are defined by the DFDL schema file, CSV_3, by selecting CSV_3.xsd from the Integration project, CSVSchemas.

Back to Read about the sample

Back to sample home