Converts a flat file containing multiple row type (denoted by row headers) into an hierarchical XML document or the reverse.

Revision History

1.0.0.0 Initial Release
1.0.0.1 Fixed a parse offset issue

Properties

Action

Type: List Input
Parse - Parses the document in FlatFileDocument and converts it into an XML document
Create - Parses the document in XmlDocument and converts it to a flat file document
Indicates the action that should be performed

FlatFileDocument

Type: Multiline Text InputOutput
The headered flat file document, see Remarks for further details.

Configuration

Type: Multiline Text Input
The configuration that defines how to parse or generate the flat file. Click Change/View to launch the editor for this Property.

XmlDocument

Type: Xml InputOutput
The XML document, see remarks for further details.


Remarks

Use this Node to convert between a multi-record flat file and an XML document. Each row in the multi-record flat file document should begin with a unique header that signals the type of row. The fields that follow the row header are then dependent on the row type. Note that when a multi-record flat file is being parsed, the characters that compose the row header are not included as part of the first field. For example, in a document that contains a row starting with A100 where A  indicates the row type, if a first field of 3 characters is specified, the returned value for the field will be 100  and not A10.

This type of flat file is common in EDI where there are typically row types for document header/footer, order header/footer and detail line amongst others.

The Configuration property is used to describe how to parse or generate the flat file.

Configuration Properties

  • Fixed Width - indicates whether the file should be treated as fixed width or delimited. In fixed width mode, column widths are specified for all columns and no Column Delimiter  is specified. In delimited mode, column widths are not specified and Column Delimiter must be specified
  • Row Delimiter - provides the character sequence that is used to delimit rows. By default this is \r\n (i.e. carriage return followed by line feed).
  • Column Delimiter - provides the character that is used to delimit columns when Fixed Width is turned off. 
  • Encapsulator - provides a character that is used to encapsulate field values (typically " ). Leave this field empty if the fields are not encapsulated

Escaped Characters

The RowDelimiter, ColumnDelimiter and Encapsulator properties allow the following escaped characters to be provided:

 

  • \\ Backslash
  • \0 ASCII character 0
  • \a Alert
  • \b Backspace
  • \f Form feed
  • \n New line. Line break in Linux. In Windows, a line break is typically \r\n 
  • \r Carriage return. In Windows, a line break is typically \r\n 
  • \v Vertical tab

Examples


See https://flowgear.me/s/dxQxEX0 for an example.

Did this answer your question?