FIX Engine has the ability to validate any incoming messages and to reject that do not fit for the FIX protocol or its FIX Dictionary. As well the OnixS::FIX::Message class has the OnixS::FIX::Message::validate method for the validation. You can specify validation criteria by validation settings, please see below for details.
Validation settings
The following settings affect on the validation process:
Also, the validation takes place when you perform the FIX message parsing from its raw (tag=value) presentation (by any corresponding OnixS::FIX::Message::parse method). In this case, the validation is performed in accordance with the specified OnixS::FIX::MessageParsingFlag value.
Field value validation
The field value validation can be performed in two following ways:
- The validation of fields values in accordance with the FIX protocol data types. The 'type' attribute must be added to the 'Field' node in the FIX Dictionary XML file. The value of the 'type' attribute must be in upper case mode, please see the example.
The validation of fields values in accordance with enum valid values of the FIX protocol (example of 'HandlInst' field valid values). Also, you can specify your own enum valid values. In this case, the 'Type' definition must be added to the FIX Dictionary XML file, and all enum values must be described in the 'Type' xml node. Additionally, the 'mode' attribute indicates that the action will be performed with your own enum valid values:
- append - given valid values will be appended to valid values of the FIX protocol
- override - given valid values will replace all valid values of the FIX protocol
- remove - given valid values will be removed from valid values of the FIX protocol
- Note
- The 'name' attribute of the 'Type' xml node must correspond to the value of the 'type' attribute in the field definition, please see the example.
Example
A basic dictionary description file with the field value type definition:
1 <?
xml version=
"1.0" encoding=
"utf-8"?>
2 <
Dialect xmlns=
"https://ref.onixs.biz/fix/dialects" 3 xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance" 4 xsi:schemaLocation=
"https://ref.onixs.biz/fix/dialects https://ref.onixs.biz/fix/dialects/dialects-2.15.xsd">
7 <
Field tag=
"52" name=
"SendingTime" type=
"UTCTIMESTAMP"/>
A basic dictionary description file with the enum values definition:
1 <?
xml version=
"1.0" encoding=
"utf-8"?>
2 <
Dialect xmlns=
"https://ref.onixs.biz/fix/dialects" 3 xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance" 4 xsi:schemaLocation=
"https://ref.onixs.biz/fix/dialects https://ref.onixs.biz/fix/dialects/dialects-2.15.xsd">
6 <
Type name=
"UserDefine" mode=
"append">
7 <
Value enum=
"4" description=
"enum description"/>
8 <
Value enum=
"5" description=
"enum description"/>
11 <
Field tag=
"21" name=
"HandlInst" type=
"UserDefine"/>