Record-Separated Fixed-Length Fields Flat File to XML
This example illustrates a transformation for fields that are not separated by a sequence of characters. These fields must have defined length.
Flat File Definition:
<BankRepository>
<Files>
<File>
<ID>SampleThree</ID>
<Messages>
<Message>
<IgnorePrecedingFieldSeparator>0</IgnorePrecedingFieldSeparator>
<DefaultEmptyFieldValue>
<Numeric>0</Numeric>
<Alpha></Alpha>
</DefaultEmptyFieldValue>
<DefaultAlignment>
<Numeric>RIGHT</Numeric>
<Alpha>LEFT</Alpha>
</DefaultAlignment>
<DefaultPadding>
<Numeric>0</Numeric>
<Alpha> </Alpha>
</DefaultPadding>
<DefaultTrim>
<Numeric>0</Numeric>
<Alpha>0</Alpha>
</DefaultTrim>
<Name>Sample</Name>
<TagName>Sample</TagName>
<EscapeChar/>
<RecordSeparator>\n</RecordSeparator>
<FieldSeparator></FieldSeparator>
<Records>
<Record>
<Name>SampleRecord</Name>
<TagName>SampleRecord</TagName>
<MinOccur>1</MinOccur>
<MaxOccur>0</MaxOccur>
<Fields>
<Field>
<Name>SampleFieldOne</Name>
<TagName>SampleFieldOne</TagName>
<DataType>Alpha</DataType>
<PaddingChar/>
<DecimalLength/>
<Alignment>LEFT</Alignment>
<StartPos>1</StartPos>
<Length>3</Length>
<DefaultValue></DefaultValue>
<Identifier>0</Identifier>
</Field>
<Field>
<Name>SampleFieldTwo</Name>
<TagName>SampleFieldTwo</TagName>
<DataType>Alpha</DataType>
<PaddingChar/>
<DecimalLength/>
<Alignment>LEFT</Alignment>
<StartPos>4</StartPos>
<Length>3</Length>
<DefaultValue></DefaultValue>
<Identifier>0</Identifier>
</Field>
</Fields>
</Record>
</Records>
</Message>
</Messages>
</File>
</Files>
</BankRepository>
Input file:
AAABBB
CCCDDD
The expected result without the surrounding envelope is:
<Sample>
<SampleRecord>
<SampleFieldOne>AAA</SampleFieldOne>
<SampleFieldTwo>BBB</SampleFieldTwo>
</SampleRecord>
<SampleRecord>
<SampleFieldOne>CCC</SampleFieldOne>
<SampleFieldTwo>DDD</SampleFieldTwo>
</SampleRecord>
</Sample>