'FIXML with QuickFix/J
Anyone using QuickFIX/J to process FIXML messages? As I understand quickfix/j does not support fixml out of the box yet. Any suggestions on how best to approach this?
Solution 1:[1]
I'm trying to validate some FIXML messages that I received from a business partner but I couldn't. I think should be a namespace problem because the parser don't identify the root tag (FIXML). Any thoughts?
Thanks a lot for any help.
Java Schema Validator
static boolean validateAgainstXSD(InputStream xml, InputStream xsd) {
try {
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = factory.newSchema(new StreamSource(xsd));
Validator validator = schema.newValidator();
validator.validate(new StreamSource(xml));
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
FIXML to be validated
<?xml version="1.0" encoding="utf-8"?>
<FIXML v="FIX.5.0SP2" xmlns:xs="http://www.fixprotocol.org/FIXML-5-0-SP2">
<TrdCaptRpt TrdID="32KGWND0000000099@20220411" ExecID="ExecID" TrdDt="2022-04-11" BizDt="2022-04-11" LastUpdateTm="2022-04-11T09:27:23.404Z" LastQty="1" LastPx="101.1" MktSegID="XEUR" LastMkt="XEUR" VenuTyp="E" TrdTyp="0" AsOfInd="0" TransTyp="0" MtchID="1" TrnsfrRsn="004" MLegRptTyp="1" Clrd="0">
<Hdr SeqNum="2587905699377885" SID="CM1_EU" TID="CM1_EU" Snt="2022-04-11T14:14:59.407564Z" SSub="FIS CD"/>
<RegTrdID Evnt="2" Typ="0" ID="E01XEURECAGWC00000000000099KGWND0000000002"/>
<Instrmt Exch="XEUR" Sym="DBK9" CFI="OCXXXN" MatDt="2023-03-31" MMY="202303" PutCall="1" StrkPx="100.0"/>
<RptSide Side="1" TrdID="32KGWND0000000099" PosEfct="O" CustOrdHdlInst="D">
<Pty ID="CM1_EU" R="1"/>
<Pty ID="CLIENT1UK_ACC1_DEFACCREF" R="24"/>
<Pty ID="A1" R="38"/>
<Pty ID="CM1_EU" R="4"/>
<Pty ID="ECAG" R="21"/>
<Pty ID="TRADER" R="12"/>
<TrdRegTS TS="2022-04-11T08:18:03.689Z" Typ="1"/>
<TrdRegTS TS="2022-04-11T14:14:59.391Z" Typ="13"/>
<TrdRegTS TS="2022-04-11T08:18:03.689Z" Typ="19"/>
<TrdRptOrdDetl OrdID="ORDERID"/>
</RptSide>
</TrdCaptRpt>
</FIXML>
XML Schema to validate
<?xml version="1.0" encoding="utf-8"?>
<!-- FIXML Schema Version FIX.5.0SP2 EP240 Generated: 2017-12-29T02:42:44.519Z
Copyright(c) FIX Protocol Limited. All rights reserved. Comments and errors
should be posted on the FIX protocol web-site http://www.fixtradingcommunity.org -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.fixprotocol.org/FIXML-5-0-SP2"
xmlns:fm="http://www.fixprotocol.org/FIXML-5-0-SP2/METADATA"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.fixprotocol.org/FIXML-5-0-SP2/METADATA fixml-metadata-5-0-SP2.xsd"
targetNamespace="http://www.fixprotocol.org/FIXML-5-0-SP2"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:include schemaLocation="fixml-tradecapture-base-5-0-SP2.xsd"/>
</xs:schema>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Marcio |
