Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-2672

type unions don't get proper length

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.2.1
    • None
    • Middle "End"
    • None

    Description

      Consider this:

       

       

      <dfdl:format ... lengthKind="implicit".../>
      
      <element name="seconds" type="tns:second"
        dfdl:lengthKind="explicit" dfdl:length="6"
        dfdl:lengthUnits="bits" dfdl:alignment="1"
        dfdl:alignmentUnits="bits"/>
      
      <simpleType name="second">
        <union>
        <simpleType>
          <restriction base="tns:checkedInt">
            <maxInclusive value="59"/>
          </restriction>
        </simpleType>
        <simpleType>
          <restriction base="tns:checkedInt">
            <enumeration value="63"/>
          </restriction>
        </simpleType>
        </union>
      </simpleType> 

      The above, the parser ends up going for a 32-bit integer, when the intention is for it to parse a 6 bit integer.

       

      This, however, works:

       

      <element name="seconds" type="tns:second"
      dfdl:lengthUnits="bits" dfdl:alignment="1"
      dfdl:alignmentUnits="bits"/>
      
      <simpleType name="second" dfdl:lengthKind="explicit" dfdl:length="6">
        <union>
        <simpleType>
          <restriction base="tns:checkedInt">
            <maxInclusive value="59"/>
          </restriction>
        </simpleType>
        <simpleType>
          <restriction base="tns:checkedInt">
            <enumeration value="63"/>
          </restriction>
        </simpleType>
        </union>
      </simpleType> 

      So it seems that the combining of properties when the type is a union does not propagate the element's properties and combine them with the properties on each of the union types. Rather, the simpleType ends up ignoring the element's properties which specify explicit length of 6 bits, and instead takes the default format length of 32 (because this is a xs:unsignedInt ultimately). 

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            mbeckerle Mike Beckerle
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: