Developer
| Parser |
|
|
|
This packages provides functionality to parse SWIFT text messages into Java objects (Message Model). By doing this, developers can work with SWIFT messages focusing on the data and not having to deal with low level syntax and character sets details.The parser performs the minimal syntax validation needed to get data from the SWIFT text message. Validation of message semantics, an SWIFT networks rules is an separated problem not addressed by the parser algorithm. Consider the following SWIFT message (extra line feeds added for formatting purposes): {1:F01BANKDEFMAXXX2039063581}{2:O1031609050901BANKDEFXAXXX89549829458949811609N}
Assuming the message is in a String variable "fin", the following code parses the FIN message into a SwiftMessage object: SwiftMessage m = (new SwiftParser()).parse(fin); The "val32a" String will contain the value "050902JPY3520000,". SwiftTagListBlock internally uses a List to store all tags found in a block. The list preserves the order of the tags found in the message and provides an API to manipulate and get the tags. The main access point to the parser is the class SwiftParser, but the feature is also available by means of the ConversionService API: SwiftMessage m = (new ConversionService()).getMessageFromFIN(fin); Some SWIFT messages have other messages appended as extra information. For example:
For performance reasons, this portions of the parsed message are stored directly as strings (using the model's UnparsedTextsList objects that can be set on messages, blocks and tags). API methods are then provided to later retrieve the unparsed texts as objects, you can think of it as "lazy" parsing of attached messages.
How can i parse/retrieve fields inside a tag?WIFE itself does not support field parsing. For example the Tag object for this tag: ":32A:050902JPY3520000," will be put the String "050902JPY3520000," as the value property. But you can use SWIFT Fields component, that is also LGPL, for doying this. With both libraries you can parse and retrieve field components with ease, for example: SwiftMessage m = (new SwiftParser()).parse(fin); |



