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

Incorrect unsparse with suspensions and changing bitOrder

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.0
    • 2.4.0
    • Back End
    • None

    Description

      Full example attached demonstrating the round trip behaviour of schema.dfdl.xsd.

      Relevent schema is:

       

      <xs:sequence>
       <xs:element name="zero" type="xs:int" dfdl:length="8" dfdl:outputValueCalc="{ ../body/zero }"
       dfdl:bitOrder="mostSignificantBitFirst" dfdl:byteOrder="bigEndian"
       />
       <xs:element name="body" dfdl:lengthKind="implicit">
        <xs:complexType>
         <xs:sequence>
          <xs:element name="a" type="xs:int" dfdl:length="4"/>
          <xs:element name="b" type="xs:int" dfdl:length="4" dfdl:outputValueCalc="{ ../zero }"/>
          <xs:element name="zero" type="xs:int" dfdl:inputValueCalc="{ 0 }"/>
         </xs:sequence>
        </xs:complexType>
       </xs:element>
      </xs:sequence>

      Note that there are 2 suspensions involved in unparsing the above.  The first byte, and second nimble of the second byte both suspend until the last element is computed.

      Also note that the bit-order changes between byte 1 and 2.

       

      Given the input:

      <tns:root xmlns:tns="urn:example">
       <zero>0</zero>
       <body>
        <a>2</a>
        <b>0</b>
        <zero>0</zero>
       </body>
      </tns:root>

      We expect unparse to reproduce input.bin exactly:

      00 02

      But instead see:

      00 00

      As if something is clobbering the value of <a>

      Attachments

        1. schema.dfdl.xsd
          1 kB
          Brandon Sloane
        2. input.bin.xml
          0.2 kB
          Brandon Sloane
        3. input.bin
          0.0 kB
          Brandon Sloane
        4. input.bin.xml.bin
          0.0 kB
          Brandon Sloane

        Activity

          People

            slawrence Steve Lawrence
            brandon.sloane Brandon Sloane
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: