[DFDL-WG] Spec section 12.3.7.2 - binary reps and zero length
Steve Hanson
smh at uk.ibm.com
Tue Jul 8 10:55:30 EDT 2014
Section 9 of the specification talks about empty etc representations,
where the meanings of a length of zero are defined. However section
12.3.7.2 has sub-sections for certain binary reps where it is illegal to
have a length of zero. Is this deliberate? The cases where 0 is allowed
are also those which can have lengthKind 'delimited' so that might be the
reason. Note that disallowing length of zero prevents use of a default
value.
12.3.7.2.1: Binary numbers. Table 22 has minimum length in bits => 0 not
allowed.
12.3.7.2.2: Floating point numbers: Says length must be exactly 4 bytes or
8 bytes => 0 not allowed.
12.3.7.2.3: Packed numbers. No minimum length stated => 0 allowed.
12.3.7.2.4: Binary booleans. Refers to 12.3.7.2.1 => 0 not allowed.
12.3.7.2.5: Binary calendars. Says length must be exactly 4 bytes or 8
bytes => 0 not allowed.
12.3.7.2.6: Packed calendars. No minimum length stated => 0 allowed.
12.3.7.2.7: Opaque binary. No minimum length stated => 0 allowed.
Noticed this when modelling an example of a header with user-defined
information at the end with the length given by a binary count.
<xs:complexType name="Type_Header">
<xs:sequence>
<xs:element dfdl:length="75" name="Filler" type="xs:hexBinary"/>
<xs:element dfdl:length="2" name="HeaderLength"
type="xs:nonNegativeInteger"/>
<xs:element dfdl:length="30" name="Filler2" type="xs:hexBinary"/>
<xs:element dfdl:length="{../HeaderLength - 108}" name="UserInfo"
type="xs:hexBinary"
minOccurs="0" dfdl:occursCountKind="implicit"/>
</xs:sequence>
</xs:complexType>
This could equally be modelled using occursCountKind 'expression' but that
seems unnecessary if the length is 0:
<xs:complexType name="Type_Header">
<xs:sequence>
<xs:element dfdl:length="75" name="Filler" type="xs:hexBinary"/>
<xs:element dfdl:length="2" name="HeaderLength"
type="xs:nonNegativeInteger"/>
<xs:element dfdl:length="30" name="Filler2" type="xs:hexBinary"/>
<xs:element dfdl:length="{../HeaderLength - 108}" name="UserInfo"
type="xs:hexBinary"
minOccurs="0" dfdl:occursCountKind="expression"
dfdl:occursCount="if (../HeaderLength - 108 eq 0) then 0 else 1"/>
</xs:sequence>
</xs:complexType>
Also what do the minimum lengths in Table 22 mean when lengthUnits is
bytes ?
Regards
Steve Hanson
Architect, IBM DFDL
Co-Chair, OGF DFDL Working Group
IBM SWG, Hursley, UK
smh at uk.ibm.com
tel:+44-1962-815848
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ogf.org/pipermail/dfdl-wg/attachments/20140708/9ebd125c/attachment.html>
More information about the dfdl-wg
mailing list