Parsing Template Structure
All SWIFT FIN messages are essentially a sequence of fields that are contained within blocks. The message syntax allows for the fact that blocks and fields can be optional, and that blocks can be nested to any level, can repeat, or embed sub-messages. Every SWIFT message consists of one to five blocks as shown in the following table.
Block ID | Block Name | Mandatory | Description |
1 | Basic Header | Yes | Contains fixed length, untagged fields. |
2 | Application Header | No | Contains fixed length, untagged fields. |
3 | User Header | No | Contains tagged, delimited fields that are mapped to individual fields. |
4 | Text | No | Contains tagged, delimited fields that are mapped to individual fields within a sub structure. This block can contain nested blocks of fields that are mapped into further sub-structures. It also can contain repeating sequences of fields, which are mapped to a sequence of structures. |
5 | Trailers | No | Contains delimited, tagged fields that are mapped to individual fields within a sub structure. |
Each of these five basic blocks is enclosed in braces {….} and is identified by a single digit. Although defined as an optional block, in practice block 4 is always present because it contains the actual message text.
Despite these complexities, the parsing templates use just two main elements: block and lineAttribute.