Fielded Text File Structure

A Fielded Text file consists of 2 main parts: Header and Body. The Body contains the lines which hold the data (the records). The Headers consist of all the lines prior to the Body (including heading lines).

At a more detail level, the header part of the file can be split into the following sections:

The body part of the text file begins either:

The record part can contain record lines and comment line (and possibly ignored blank lines). A record line contains the actual data - ie. a row of values. Each record line consists of a sequence of field values. The format of these field values is specified by the Meta. The Meta also specifies the structure of the record lines, including how field values are separated.

It is possible for a record to span multiple lines in the text file. This will occur when a field value contains an “End of Line” character(s). If a record does span multiple lines, then any line in that record will not be treated as comment line or an ignored blank line. Accordingly, it is possible for lines in the body part to begin with a line comment character but not be treated as a comment line.

Meta file Structure

The Meta contains the following groups of information:

Main Section which specifies properties applying to the whole text file. In the above example Meta file, the attributes in the >FieldedText> element apply to the whole text file and make up the main section. The Main Section can contain the following properties/attributes:

AttributeDescriptionDefault
CultureSpecifies which regional conventions should be used. (RFC 4646)Invariant
EndOfLineTypeMethod used to detect line ends in text fileAuto
EndOfLineCharCharacter which denotes line end when EndOfLineType is “Char”;
EndOfLineAutoWriteTypeMethod used to write line ends when EndOfLineType = “Auto”Local
LastLineEndedTypeWhether last line is terminated with End of Line character(s)Optional
EndOfLineIsSeparatorEnd Of Line separates records instead of terminating records. (Deprecated in Version 1.1. Use LastLineEndedType instead)False
QuoteCharCharacter used to quote a field value (ie enclose field value)
DelimiterCharCharacter which separates fields in a line,
LineCommentCharCharacter which, if it’s first in line, denotes that line is a comment0x04
StuffedEmbeddedQuotesQuotes can be embedded in a quoted field by having 2 in a rowTrue
SubstitutionEnabledEnables substitutions in the textFalse
SubstitutionCharCharacter which identifies a substitution\
AllowEndOfLineCharInQuotesAllow End of Line character(s) within a quoted stringTrue
IgnoreBlankLinesIgnore blank lines in the textTrue
IgnoreExtraCharsIgnore any characters in a line after all fields have been parsedTrue
AllowIncompleteRecordsLines do not need to contain all fields expected by a recordFalse
HeadingLineCountNumber of heading lines0
MainHeadingLineIndexIndex of Main Heading line0
HeadingConstraintDefault Constraints applied to field headingsNone
HeadingQuotedTypeDefault specification for how field heading values are quotedOptional
HeadingAlwaysWriteOptionalQuoteDefault specifier for whether field heading optional quotes should be writtenTrue
HeadingWritePrefixSpaceDefault specifier for whether field headings should be prefixed with a space when writtenFalse
HeadingPadAlignmentDefault alignment of padding for fixed width field headingsAuto
HeadingPadCharTypeDefault method used to pad fixed width field headingsEndOfValue
HeadingPadCharDefault character used to pad fixed width field headings<space>
HeadingTruncateTypeDefault method used to truncate fixed width field headingsRight
HeadingTruncateCharDefault character used to fill truncated field headings if HeadingTruncateType = TruncateChar#
HeadingEndOfValueCharDefault character used to flag End of Field Heading when HeadingPadCharType = EndOfValue0x03

Field Sections which specify the properties of each field of data used within the text file. In the above example Meta file, the attributes in a <Field> element apply to the respective field and make up a field section. A Field Section can contain the following properties/attributes:

AttributeDescriptionDefault
DataTypeField Data TypeString
IndexExplicitly specifies position of field
IdTag available for User Definition0
NameField Name<Blank>
FixedWidthSpecifies whether field has a fixed number of charactersFalse
WidthNumber of characters in field if FixedWidth = True1
HeadingConstraintConstraints applied to headingsMain HeadingConstraint
ConstantField is a constantFalse
ValueQuotedTypeSpecification for how field values are quotedOptional
ValueAlwaysWriteOptionalQuoteSpecifier for whether a value’s optional quotes should be writtenFalse
ValueWritePrefixSpaceSpecifier for whether values should be prefixed with a space when writtenFalse
ValuePadAlignmentAlignment of padding for fixed width field valuesAuto
ValuePadCharTypeMethod used to pad fixed width field valuesEndOfValue
ValuePadCharCharacter used to pad fixed width field valuesDepends on DataType
ValueTruncateTypeMethod used to truncate fixed width field valuesException
ValueTruncateCharCharacter used to fill truncated field values if ValueTruncateType = TruncateChar#
ValueEndOfValueCharCharacter used to flag End of Field Value when ValuePadCharType = EndOfValue0x03
ValueNullCharCharacter used to fill truncated field values if ValueTruncateType = NullChar*
HeadingQuotedTypeSpecification for how heading values are quotedMain HeadingQuotedType
HeadingAlwaysWriteOptionalQuoteSpecifier for whether heading optional quotes should be writtenMain HeadingAlwaysWriteOptionalQuote
HeadingWritePrefixSpaceSpecifier for whether headings should be prefixed with a space when writtenMain HeadingWritePrefixSpace
HeadingPadAlignmentAlignment of padding for fixed width field headingsMain HeadingPadAlignment
HeadingPadCharTypeMethod used to pad fixed width field headingsMain HeadingPadCharType
HeadingPadCharCharacter used to pad fixed width field headingsMain HeadingPadChar
HeadingTruncateTypeMethod used to truncate fixed width field headingsMain HeadingTruncateType
HeadingTruncateCharCharacter used to fill truncated field headings if HeadingTruncateType = TruncateCharMain HeadingTruncateChar
HeadingEndOfValueCharCharacter used to flag End of Field Heading when HeadingPadCharType = EndOfValueMain HeadingEndOfValueChar
HeadingsField Headings as comma text<Blank>
NullSpecifies whether field value is Null if Constant = TrueFalse
ValueSpecifies field value if Constant = TrueDepends on DataType
FormatText format of field valueDepends on DataType
StylesEither restrict or allow additional formatting when parsing text field valuesDepends on DataType
FalseTextText presentation of Boolean field False valueFalse
TrueTextText presentation of Boolean field True valueTrue

Fields can have a DataType of: String, Boolean, Integer, Float, Decimal (similar to Float but better suited for financial calculations) or DateTime. Some of the attributes listed above are not applicable to all field DataTypes and some use different values in different DataTypes.

Substitution Sections specify which substitutions are used within the text file. Substitutions are similar to Escape Sequences used in some CSV files (eg \n). A Substitution Section can contain the following properties/attributes:

AttributeDescriptionDefault
TypeThe type of substitutionString
TokenA character which determines the substitution to be invoked
ValueThe string value to replace the substitution character and token (if Type = String)

Sequence Sections. A Fielded Text file can have lines with different sets of fields depending on the value of a key field(s). The Sequence Sections in the Meta File specify the sequence of fields which can follow a key field. A Sequence Section can contain the following properties/attributes:

AttributeDescriptionDefault
NameName of Sequence
RootSpecifies whether this is the first sequence invoked for each record (line)False.
FieldIndicesShorthand list of fields in this sequence (Field indices array in commatext string)<Blank>

Each Sequence has a series of <Item> elements which specify the fields included in the sequence. An <Item> element can contain the following properties/attributes:

AttributeDescriptionDefault
IndexExplicitly specifies position of Sequence Item in Sequence
FieldIndexIndex of field (in Field List) used by this Sequence Item

An <Item> element can also contain a series of <Redirect> elements. The <Redirect> elements determine which sequence should be invoked if a field contains specified values. A <Redirect> element can contain the following properties/attributes:

AttributeDescriptionDefault
IndexExplicitly specifies position of Redirect
TypeSpecifies type of comparison Redirect makes with Field ValueDepends on DataType of Sequence Item’s Field
SequenceNameName of Sequence to be invoked if the Field’s Value matches the Redirect Value
InvokationDelaySpecifies whether specified Sequence should be invoked after current field or after current sequenceAfterField
ValueValue against which Field Value is comparedDepends on Redirect Type