CSV messaging standard

The comma separated value (CSV) format is a typical format for describing data in tables or spreadsheets.

The CSV format is used to exchange data between database applications or spreadsheet applications. Although the CSV format is widely used, a definitive specification has not been formally documented. However, these are some of the rules that characterize the CSV format:

  • Data fields are separated by commas, and groups of data fields are separated by repeating field delimiters (for example, the <CR><LF> combination of ASCII characters).
    Here is a typical CSV message:
    12345,Smith,John,"3, North Street"<CR><LF>
    41352,Jones,Ivor,"5, South Road"<CR><LF>
    53421,Edwards,David,"10, East Lane"
  • A comma that occurs within a data field is regarded as part of the data, rather than as a field separator, only if the comma is surrounded by quotation marks (").
  • A quotation mark character (") that is within a data field that is enclosed within quotation marks must always be 'escaped' by another instance of the quotation mark character.

    For example, xx"xx must be written as "xx""xx", and "xxxx" must be written as """xxxx""".

  • In an input message, any variable length data field can be enclosed within quotation mark characters, regardless of whether the field contains any special characters such as quotation mark characters, escape characters, or other reserved characters.

    The quotation mark characters must occur at the start and end of the data, are stripped from the data when the field is parsed, and are not added to the output tree. For example, the data A,"B",C results in an output tree that contains the values A, B, and C.

  • If a data field contains two quotation mark characters and nothing else, the quotation mark characters are removed by the parser and the data field is processed in the same way as an empty field.

CSV messages can be modeled by using Data Format Description Language (DFDL) schema files; see Data Format Description Language (DFDL).

You can also create a CSV message model by using the New Message Model wizard and selecting the CSV option.