Hello DFDL community,
* The input is binary.
* There is a sequence of sections.
* Section 1 is identified by the 2-bit code 01. There are zero or more of
Section 1. The content of each Section 1 is a 3-bit unsigned int followed by a
1-bit unsigned int.
* Section 2 is identified by the 2-bit code 10. There are zero or more of
Section 2. The content of each Section 2 is a 4-bit unsigned int followed by a
2-bit unsigned int.
* Section 3 is identified by the 2-bit code 11. There are zero or more of
Section 4. The content of each Section 3 is a 4-bit unsigned int followed by a
5-bit unsigned int.
* Afterwards, there is padding to fill the last byte.
One way to model the input is as a sequence of arrays:
<xs:element name="input">
<xs:complexType>
<xs:sequence>
<xs:element name="Section_1" type="Section_1_type"
minOccurs="0" maxOccurs="unbounded"
dfdl:occursCountKind="implicit"/>
<xs:element name="Section_2" type="Section_2_type"
minOccurs="0" maxOccurs="unbounded"
dfdl:occursCountKind="implicit"/>
<xs:element name="Section_3" type="Section_3_type"
minOccurs="0" maxOccurs="unbounded"
dfdl:occursCountKind="implicit"/>
<xs:sequence dfdl:hiddenGroupRef="padToByteBoundary" />
</xs:sequence>
</xs:complexType>
</xs:element>
A second way to model the input is as a repeatable section that contains a
choice:
<xs:element name="input">
<xs:complexType>
<xs:sequence>
<xs:element name="Section" maxOccurs="unbounded"
dfdl:occursCountKind="implicit">
<xs:complexType>
<xs:sequence>
<xs:element name="code" type="unsignedint2" />
<xs:choice dfdl:choiceDispatchKey="{xs:string(./code)}"
dfdl:choiceLengthKind="implicit">
<xs:element name="Section_1" type="Section_1_type"
dfdl:choiceBranchKey="1" />
<xs:element name="Section_2" type="Section_2_type"
dfdl:choiceBranchKey="2" />
<xs:element name="Section_3" type="Section_3_type"
dfdl:choiceBranchKey="3" />
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:sequence dfdl:hiddenGroupRef="padToByteBoundary" />
</xs:sequence>
</xs:complexType>
</xs:element>
Which way do you recommend and why?
/Roger