Data Format Description Language (DFDL) v1.0 Specification
OGF Proposed Recommendation GFD-P-R.174, January 31, 2011
In DFDL, ordered and unordered are characteristics of the representation only. Logically, sequence groups are always in schema order.
The semantics of unordered groups (sequence with dfdl:sequenceKind='unordered' property) are expressed by way of a source-to-source transformation of the declaration, and by a data transformation on the resulting value. An implementation may use any technique consistent with this semantic.
The source to source transformation turns the declaration of an unordered group into an ordered sequence that contains an array element that contains a choice. Each element declaration of the unordered group becomes an alternative element within the choice. The unordered group's separator and terminator become the Separator and Terminator of the surrounding sequence. The dfdl:sequenceKind property is dropped, but other DFDL annotation properties are preserved. The xs:maxOccurs and xs:minOccurs on any element of the unordered sequence are dropped when the element is placed into the choice.
<xs:sequence dfdl:sequenceKind="unordered">
<xs:element name="a" type="xs:string" dfdl:initiator="A:" />
<xs:element name="b" type="xs:int" minOccurs="0" dfdl:initiator="B:" />
<xs:element name="c" type="xs:string" minOccurs="0" maxOccurs="10"
dfdl:initiator="C:" />
</xs:sequence>
<xs:element name="dummy">
<xs:complexType>
<xs:choice>
<xs:element name="a" type="xs:string" dfdl:initiator="A:" />
<xs:element name="b" type="xs:int" dfdl:initiator="B:" />
<xs:element name="c" type="xs:string" dfdl:initiator="C:" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:sequence dfdl:sequenceKind="ordered">
<xs:element ref="dummy" minOccurs="1" maxOccurs="12"/>
</xs:sequence>
Schema definition errors are then detected as for choice group types. Notice how the xs:minOccurs and xs:maxOccurs for the rewritten element reference are computed based on the possible occurrences from the original source.
Processing then constructs this array element by parsing the data.
<xs:sequence>
<xs:element name="a" type="xs:string" />
<xs:element name="b" type="xs:int" minOccurs="0" />
<xs:element name="c" type="xs:string" minOccurs="0"
maxOccurs="10" />
</xs:sequence>
This is a logical-value to logical value transformation. Ordered and unordered are characteristics of the representation only. The transformation here is the obvious one where all array elements having the first choice alternative as their value are accumulated into the first child element of the logical sequence. If there is either no such value or more than one such value, then the first child element must be an array or optional declaration (appropriate xs:minOccurs and xs:maxOccurs) so that it can accommodate the number of values found. The dimensionality of the first element must accommodate the number of values actually found. It is a processing error if it cannot. This algorithm repeats for the array elements having the 2nd choice alternative as their value, and so on until all the choice alternative values have been moved into their corresponding elements/arrays in the logical sequence group, and all logical sequence elements have been populated in a manner conforming to their xs:minOccurs constraints.
An unordered sequence is of fixed length if the same sequence is fixed length when the unordered property is removed.
On Unparsing, the behavior is exactly as if dfdl:sequenceKind='ordered'. That is, the elements are output in schema declaration order.
Copyright (C) Open Grid Forum (2005-2010). All Rights Reserved.
This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the OGF or other organizations, except as needed for the purpose of developing Grid Recommendations in which case the procedures for copyrights defined in the OGF Document process must be followed, or as required to translate it into languages other than English.