Fixed-length records and field flat file to XML
When no record separators are available, the records must consist of all fixed length fields. This example illustrates a transformation from fixed-length record and field flat file to XML.
Flat File Definition:
<BankRepository>
<Files>
<File>
<ID>SampleFive</ID>
<Messages>
<Message>
<IgnorePrecedingFieldSeparator>1</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>1</Numeric>
<Alpha>0</Alpha>
</DefaultTrim>
<Name>TopNode</Name>
<TagName>TopNode</TagName>
<EscapeChar/>
<RecordSeparator></RecordSeparator>
<FieldSeparator></FieldSeparator>
<FixedLengthSeparator>1</FixedLengthSeparator>
<Records>
<Record>
<Name>RecordOne</Name>
<TagName>RecordOne</TagName>
<MinOccur>1</MinOccur>
<MaxOccur>0</MaxOccur>
<Fields>
<Field>
<Name>Field1</Name>
<TagName>Field1</TagName>
<DataType>Alpha</DataType>
<PaddingChar/>
<DecimalLength/>
<Alignment>LEFT</Alignment>
<StartPos>1</StartPos>
<Length>1</Length>
<DefaultValue></DefaultValue>
<Identifier>0</Identifier>
</Field>
<Field>
<Name>Field2</Name>
<TagName>Field2</TagName>
<DataType>Alpha</DataType>
<PaddingChar/>
<DecimalLength/>
<Alignment>LEFT</Alignment>
<StartPos>2</StartPos>
<Length>1</Length>
<DefaultValue></DefaultValue>
<Identifier>0</Identifier>
</Field>
</Fields>
</Record>
</Records>
</Message>
</Messages>
</File>
</Files>
</BankRepository>
Input file content:
abCDeFGh
The expected result without the surrounding envelope is:
<TopNode>
<RecordOne>
<Field1>a</Field1>
<Field2>b</Field2>
</RecordOne>>
<RecordOne>
<Field1>C</Field1>
<Field2>D</Field2>
</RecordOne>>
<RecordOne>
<Field1>e</Field1>
<Field2>F</Field2>
</RecordOne>>
<RecordOne>
<Field1>G</Field1>
<Field2>h</Field2>
</RecordOne>
</TopNode>