Filters

Each filter group has zero or more filters. With these filters, you can have access to even finer-grained control of validation.

Filtering does not apply to parse errors, only to validation errors. If a SWIFT message is invalid at a fundamental structural level and cannot be parsed, such parse errors cannot be filtered out.

MT Filters

Each MT filter contains a disable path specification and an optional error code.

A path specification is an XPath-like string that identifies one or more fields in a SWIFT MT message. See Path Specification for details on how to construct path specifications. All fields that match the MT filter's path specification have their validation warnings ignored.

If an MT filter also contains a SWIFT error code, then in addition to a path match with a field, only those validation errors with that particular error code are ignored. With this feature, you can have access to even finer-grained control of validation.

Consider the following filter for MT messages:

<FILTER PATH="Text/A/22C//"/>

The preceding filter ignores validation errors for all occurrences of field 22C in sequence A, for all messages in the filter's filter group. Another example:

<FILTER PATH="Text/A/22C//" ERRORCODE="T22"/>

This filter is more fine-grained than the previous filter. It only ignores validation errors on field 22C in sequence A with SWIFT error code T22. All other validation errors for this field pass through the filter.

Not all MT filters have to apply to the text block of a SWIFT MT message. The following filter disables validation of the basic header's Logical Terminal Address:

<FILTER PATH="Basic/LT"/>

The following XML contains examples of how to disable various kinds of validation:

<FILTERLIST>
<!--Disable validation of 23G, and 98B, but only for message type 509 -->
<FILTERGROUP MESSAGETYPE="509">
<FILTER PATH="Text/A/23G//" />
<FILTER PATH="Text/B/QG98/98B//" />
</FILTERGROUP>
<!-- Disable basic header LTA validation for all SWIFT messages-->
<FILTERGROUP MESSAGETYPE="*">
<FILTER PATH="Basic/LT" />
</FILTERGROUP>
<!-- Disable very specific validation of field 22C for error code T22 -->
<FILTERGROUP MESSAGETYPE="365">
<FILTER PATH="Text/A/22C//" ERRORCODE="T22" />
</FILTERGROUP>
</FILTERLIST>

For more details, see the ValidationFilter.xml file in the TIBCO_HOME/bw/palettes/swift/version_number/samples/ValidationFilter_for_MT directory.

Path Specification

An MT filter uses a subset of the XPath grammar with a few additional abbreviations to identify one or more elements of a message.

The XPath like syntax for the identifying path is composed of tokens separated by the slash (/) character. Each token is composed of an element name or the wildcard character (*). Optionally a predicate can be added inside square brackets immediately following the element name. The predicates supported are a simple one based index to identify the position of an element and an expression to identify an attribute of the element. You can only use one predicate in square brackets for each element name. In addition, only tag fields support the attribute value expression. You can use an additional abbreviation with the attribute matching expression. Multiple values can be entered separately by a vertical bar to denote that either of the supplied values must match.

The slash separator character is used to mark the separation of element names. They are also used to identify characteristics of the start and end of the path. A slash at the start of a path identifies the path as an absolute path. Since all paths are evaluated from the message, the path can be a relative path that does not start with a slash or an absolute path that does start with a slash. As an addition to XPath, a slash at the end of the path indicates that the path must match the last name in the path as well as any immediate children of that element. Two slashes indicate all descendants of the element must match.

The following table shows the description of the path specification abbreviations:

Field Description
Text The message Text block as sequences
Basic The message Basic Header: AppId, Service, LT, Session, Sequence
App The message Application Header:
  • io: IO flag, either "I" or "O".
  • I: Input Header: Type, Receiver, Priority, Delivery, Obsolescence.
  • O: Output Header: Type, InputTime, MIR, OutputDate, OutputTime, Priority.
User The message User Header
Tags The message Text block as a flat list of tag fields
Trailer The message Trailer
S The message SWIFT Alliance trailer if it exists

Valid Paths Example

The following table lists examples of valid paths:

Example Description
/Basic/AppId The AppId in the Basic Header
/Basic/* Any subfield of the Basic Header
Basic/*[2] The second subfield in the Basic Header
Basic/2 The second subfield in the Basic Header
/Text/A/A1[2]/A1a/16R/1 The first subfield of a 16R
/Text/A/*[2]/16R/Qualifier Any second sequence in A
Text/A/*/57D/2-3 Subfield 2 to 3 of tag field 57D in any sequence in A
/Tags/16R/Qualifier Used to identify the subfield by name
Tags/*/1 The first subfield of the any tag field
/App/O/MIR MIR in the Output Header of the Application Header
/App/io The io value for the Application Header
/User/119 Subfield 119 of the User Header
Trailer/MAC Subfield MAC of the Trailer
/Text/A/ A and any immediate sequences, qualifier groups, or fields
Text/A// A and any descendent sequences, qualifier groups, or fields
/Text/A/A1[2]/QG22/22F [@Qualifier=MICO] A 22F tag field where the Qualifier subfield is 'MICO'
Text/A/A1[2]/QG22/22F [@Qualifier=MICO|FORM] A 22F tag field where the Qualifier subfield is 'MICO' or 'FORM'
// The message and any element in the message

Invalid Paths

The following table lists the invalid paths:

Field Description
Text/A/A1[2]/A1a/16RS/ Qualifier Multiple option characters for tags with different field names are not supported.
Invalid/12A/2 Invalid part of the message.