Skip to content

Commit 16b8fc6

Browse files
authored
Merge pull request #100 from donmendelson/issue94
Update XML schema to support XInclude, revert to XSD v1.0
2 parents 62fd24f + a930f7e commit 16b8fc6

File tree

8 files changed

+630
-12
lines changed

8 files changed

+630
-12
lines changed

v2-0-RC2/doc/00Title.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ FIX Simple Binary Encoding
55

66
## Technical Specification
77

8-
Version 2.0 Release Candidate 2
8+
Version 2.0 Release Candidate 2
99

1010
**THIS DOCUMENT IS A RELEASE CANDIDATE FOR A PROPOSED FIX TECHNICAL
1111
STANDARD. A RELEASE CANDIDATE HAS BEEN APPROVED BY THE GLOBAL TECHNICAL

v2-0-RC2/doc/01Introduction.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ may be customized as needed by agreement between counterparties.
6363
Glossary
6464
------------------------------------------------------------------------------------------------------
6565

66+
6667
**Character set** - A mapping between a sequence of octets and a sequence of characters.
6768

6869
**Data type** - A field type with its associated encoding attributes,
@@ -191,4 +192,7 @@ Representation of dates and times
191192
Securities and related financial instruments - Codes for exchanges and
192193
market identification (MIC)
193194

194-
[W3C XML Schema version 1.1](https://www.w3.org/TR/2006/REC-xml11-20060816/)
195+
*W3C XML Schema version 1.0* [Part 1](https://www.w3.org/TR/xmlschema-1/) [Part 2](https://www.w3.org/TR/xmlschema-2/)
196+
197+
[W3C XML Inclusions (XInclude) Version 1.0](https://www.w3.org/TR/xinclude/)
198+

v2-0-RC2/doc/02FieldEncoding.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,6 @@ Wire format of char encoding of "A" (value 65, hexadecimal 41)
540540

541541
`41`
542542

543-
544-
545543
### Fixed-length character array
546544

547545
Character arrays are allocated a fixed space in a message, supporting
@@ -568,7 +566,6 @@ Character arrays are constrained to single-byte characters sets with the same ch
568566
Other 8-bit encodings may be specified in a message schema with the characterEncoding attribute. The value of characterEncoding should be a preferred
569567
character set name registered with IANA.
570568

571-
572569
#### Examples of fixed-length character arrays
573570

574571
A typical string encoding specification

v2-0-RC2/doc/04MessageSchema.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ XML schema for SBE message schemas
55
---------
66
See [sbe.xsd](../resources/sbe.xsd) for the normative XML Schema Definition (XSD) for SBE.
77

8-
The SBE schema is defined with W3C XML Schema Definition Language (XSD) version 1.1.
8+
The SBE schema is defined with W3C XML Schema Definition Language (XSD) version 1.0. (XSD version 1.1 was standardized.
9+
However, since it is not supported by all XML processors, the SBE XSD is constrained to features of version 1.0.)
10+
11+
### XInclude usage
12+
13+
Certain elements of the SBE message schema support inclusion from a separate XML file. The result of the XInclude mechanism
14+
is a single XML infoset, so the schema description below applies whether a single file is used or multiple files are assembled.
915

1016

1117
XML namespace
@@ -82,8 +88,18 @@ Data encodings
8288

8389
### Encoding sets
8490

85-
The `<types>` element contains one or more sets of data encodings used
86-
for messages within the schema.
91+
A `<types>` element contains a set of data encodings used by messages within a schema. A message schema may have multiple
92+
instances of `<types>`, if desired, to organize them by categories. Each `<types>` element may have an associated `package` name.
93+
94+
**`<types>` element attribute**
95+
96+
| Schema attribute | Description | XML type | Usage | Valid values |
97+
|------------------|--------------------------------------------------------------------------------------------------|--------------------|------------------------|------------------------------------------------------------------------------|
98+
| package | Overrides package of messageSchema | string | optional | Should be unique between counterparties but no naming convention is imposed. |
99+
100+
The `<types>` element has attribute `xml:base` to support inclusion from a separate XML file using the XInclude mechanism.
101+
Thus, common encoding types may be shared across multiple SBE message schemas.
102+
87103

88104
Within each set, an unbound number of encodings will be listed in any
89105
sequence:
@@ -371,13 +387,24 @@ Multi-value choice example, The choice is encoded as a bitset.
371387
</set>
372388
```
373389

374-
Message template
390+
Message templates
375391
--------------------------------------------------------------------------------------------------------------
376392

377-
To define a message type, add a `<message>` element to the root element
378-
of the XML document, `<messageSchema>`.
393+
A `<messages>` element contains a set of message templates. A message schema may have multiple
394+
instances of `<messages>`, if desired, to organize them by categories. Each `<messages>` element may have an associated `package` name.
395+
396+
**`<messages>` element attribute**
397+
398+
| Schema attribute | Description | XML type | Usage | Valid values |
399+
|------------------|--------------------------------------------------------------------------------------------------|--------------------|------------------------|------------------------------------------------------------------------------|
400+
| package | Overrides package of messageSchema | string | optional | Should be unique between counterparties but no naming convention is imposed. |
401+
402+
The `<messages>` element has attribute `xml:base` to support inclusion from a separate XML file using the XInclude mechanism.
403+
Thus, common message templates may be shared across multiple SBE message schemas.
404+
405+
To define a message type, add a `<message>` element to `<messages>`.
379406

380-
The `name` and `id` attributes are required. The first is a display name for
407+
The `name` and `id` attributes of `<message>` are required. The first is a display name for
381408
a message, while the latter is a unique numeric identifier, commonly
382409
called template ID.
383410

v2-0-RC2/resources/xml/examples.xml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+
<sbe:messageSchema xmlns:sbe="http://fixprotocol.io/2017/sbe" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xi="http://www.w3.org/2001/XInclude" package="examples" id="91" version="0" byteOrder="littleEndian" xsi:schemaLocation="http://fixprotocol.io/2017/sbe ../xsd/sbe.xsd">
3+
<!-- include commonly used types -->
4+
<xi:include href="types-include.xml" parse="xml"/>
5+
<types>
6+
<type name="date" primitiveType="uint16"/>
7+
<type name="enumEncoding" primitiveType="char"/>
8+
<type name="idString" length="8" primitiveType="char"/>
9+
<type name="intEnumEncoding" primitiveType="uint8"/>
10+
<type name="currency" length="3" primitiveType="char" description="ISO 4217"/>
11+
<composite name="DATA">
12+
<type name="length" primitiveType="uint16"/>
13+
<type name="varData" length="0" primitiveType="uint8"/>
14+
</composite>
15+
<composite name="groupSizeEncoding">
16+
<type name="blockLength" primitiveType="uint16"/>
17+
<type name="numInGroup" primitiveType="uint16"/>
18+
<type name="numGroups" primitiveType="uint16"/>
19+
<type name="numVarDataFields" primitiveType="uint16"/>
20+
</composite>
21+
<composite name="messageHeader">
22+
<type name="blockLength" primitiveType="uint16"/>
23+
<type name="templateId" primitiveType="uint16"/>
24+
<type name="schemaId" primitiveType="uint16"/>
25+
<type name="version" primitiveType="uint16"/>
26+
<type name="numGroups" primitiveType="uint16"/>
27+
<type name="numVarDataFields" primitiveType="uint16"/>
28+
</composite>
29+
<composite name="decimalEncoding">
30+
<type name="mantissa" presence="optional" primitiveType="int64"/>
31+
<type name="exponent" presence="constant" primitiveType="int8">-3</type>
32+
</composite>
33+
<composite name="qtyEncoding">
34+
<type name="mantissa" primitiveType="int32"/>
35+
<type name="exponent" presence="constant" primitiveType="int8">0</type>
36+
</composite>
37+
<composite name="timestampEncoding" description="UTC timestamp with nanosecond precision">
38+
<type name="time" primitiveType="uint64"/>
39+
<type name="unit" primitiveType="uint8" presence="constant" valueRef="TimeUnit.nanosecond"/>
40+
</composite>
41+
<enum name="TimeUnit" encodingType="uint8">
42+
<validValue name="second">0</validValue>
43+
<validValue name="millisecond">3</validValue>
44+
<validValue name="microsecond">6</validValue>
45+
<validValue name="nanosecond">9</validValue>
46+
</enum>
47+
<enum name="businessRejectReasonEnum" encodingType="intEnumEncoding">
48+
<validValue name="Other">0</validValue>
49+
<validValue name="UnknownID">1</validValue>
50+
<validValue name="UnknownSecurity">2</validValue>
51+
<validValue name="ApplicationNotAvailable">4</validValue>
52+
<validValue name="NotAuthorized">6</validValue>
53+
</enum>
54+
<enum name="execTypeEnum" encodingType="enumEncoding">
55+
<validValue name="New">0</validValue>
56+
<validValue name="DoneForDay">3</validValue>
57+
<validValue name="Canceled">4</validValue>
58+
<validValue name="Replaced">5</validValue>
59+
<validValue name="PendingCancel">6</validValue>
60+
<validValue name="Rejected">8</validValue>
61+
<validValue name="PendingNew">A</validValue>
62+
<validValue name="Trade">F</validValue>
63+
</enum>
64+
<enum name="ordStatusEnum" encodingType="enumEncoding">
65+
<validValue name="New">0</validValue>
66+
<validValue name="PartialFilled">1</validValue>
67+
<validValue name="Filled">2</validValue>
68+
<validValue name="DoneForDay">3</validValue>
69+
<validValue name="Canceled">4</validValue>
70+
<validValue name="PendingCancel">6</validValue>
71+
<validValue name="Rejected">8</validValue>
72+
<validValue name="PendingNew">A</validValue>
73+
<validValue name="PendingReplace">E</validValue>
74+
</enum>
75+
<enum name="ordTypeEnum" encodingType="enumEncoding">
76+
<validValue name="Market">1</validValue>
77+
<validValue name="Limit">2</validValue>
78+
<validValue name="Stop">3</validValue>
79+
<validValue name="StopLimit">4</validValue>
80+
</enum>
81+
<enum name="sideEnum" encodingType="enumEncoding">
82+
<validValue name="Buy">1</validValue>
83+
<validValue name="Sell">2</validValue>
84+
</enum>
85+
</types>
86+
<messages>
87+
<sbe:message name="ExecutionReport" id="98" blockLength="42" semanticType="8">
88+
<field name="OrderID" id="37" type="idString" offset="0" semanticType="String"/>
89+
<field name="ExecID" id="17" type="idString" offset="8" semanticType="String"/>
90+
<field name="ExecType" id="150" type="execTypeEnum" offset="16" semanticType="char"/>
91+
<field name="OrdStatus" id="39" type="ordStatusEnum" offset="17" semanticType="char"/>
92+
<field name="Symbol" id="55" type="idString" offset="18" semanticType="String"/>
93+
<field name="MaturityMonthYear" id="200" type="MONTH_YEAR" offset="26" semanticType="MonthYear"/>
94+
<field name="Side" id="54" type="sideEnum" offset="31" semanticType="char"/>
95+
<field name="LeavesQty" id="151" type="qtyEncoding" offset="32" semanticType="Qty"/>
96+
<field name="CumQty" id="14" type="qtyEncoding" offset="36" semanticType="Qty"/>
97+
<field name="TradeDate" id="75" type="date" offset="40" semanticType="LocalMktDate"/>
98+
<group name="FillsGrp" id="2112" blockLength="12" dimensionType="groupSizeEncoding">
99+
<field name="FillPx" id="1364" type="decimalEncoding" offset="0" semanticType="Price"/>
100+
<field name="FillQty" id="1365" type="qtyEncoding" offset="8" semanticType="Qty"/>
101+
</group>
102+
</sbe:message>
103+
<sbe:message name="NewOrderSingle" id="99" blockLength="54" semanticType="D">
104+
<field name="ClOrdId" id="11" type="idString" offset="0" semanticType="String"/>
105+
<field name="Account" id="1" type="idString" offset="8" semanticType="String"/>
106+
<field name="Symbol" id="55" type="idString" offset="16" semanticType="String"/>
107+
<field name="Side" id="54" type="sideEnum" offset="24" semanticType="char"/>
108+
<field name="TransactTime" id="60" type="timestampEncoding" offset="25" semanticType="UTCTimestamp"/>
109+
<field name="OrderQty" id="38" type="qtyEncoding" offset="33" semanticType="Qty"/>
110+
<field name="OrdType" id="40" type="ordTypeEnum" offset="37" semanticType="char"/>
111+
<field name="Price" id="44" type="decimalEncoding" offset="38" semanticType="Price" presence="optional"/>
112+
<field name="StopPx" id="99" type="decimalEncoding" offset="46" semanticType="Price" presence="optional"/>
113+
</sbe:message>
114+
</messages>
115+
<!-- include commonly used messages -->
116+
<xi:include href="messages-include.xml" parse="xml"/>
117+
</sbe:messageSchema>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<messages xmlns:sbe="http://fixprotocol.io/2017/sbe" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" description="Commonly used messsages may be imported into multiple message schemas using XInclude">
3+
<sbe:message name="BusinessMessageReject" id="97" blockLength="9" semanticType="j">
4+
<field name="BusinesRejectRefId" id="379" type="idString" offset="0" semanticType="String"/>
5+
<field name="BusinessRejectReason" id="380" type="businessRejectReasonEnum" offset="8" semanticType="int"/>
6+
<data name="Text" id="58" type="DATA" semanticType="data"/>
7+
</sbe:message>
8+
</messages>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<types xmlns:sbe="http://fixprotocol.io/2017/sbe" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
description="Commonly used types may be imported into multiple message schemas using XInclude">
4+
<composite name="MONTH_YEAR">
5+
<type name="year" primitiveType="uint16"/>
6+
<type name="month" primitiveType="uint8"/>
7+
<type name="day" primitiveType="uint8"/>
8+
<type name="week" primitiveType="uint8"/>
9+
</composite>
10+
</types>

0 commit comments

Comments
 (0)