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

prefixLengthType needs to evaluate asserts before using the prefix value

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.2.1
    • None
    • Back End, Diagnostics
    • None

    Description

      We want to use lengthKind 'prefixed' and avoid the complexity of dfdl:outputValueCalc and dfdl:lengthKind 'explicit' with a length expression.

      But... using prefixed is much less robust, because the prefix value is currently used to pull data (when parsing) and assertions expressed on the prefixLengthType seem to never be evaluated.

      E.g., below we have a prefixed-length field named 'payload'.

      The range is only 0 to 32768, but this assert never executes. 

              ...
              <complexType>
                <sequence>
                  <element name="payload" type="xs:hexBinary"
                           dfdl:lengthKind="prefixed"
                           dfdl:prefixIncludesPrefixLength="no"
                           dfdl:prefixLengthType="p8:bufferPayload"/>
                </sequence>
              </complexType>
              ...
      
      
      <simpleType name="bufferPayload">
        <annotation>
          <appinfo source="http://www.ogf.org/dfdl/">
            <dfdl:assert>{ dfdl:checkConstraints(.) }</dfdl:assert>
          </appinfo>
        </annotation>
        <restriction base="p8:unsignedLong">
          <minInclusive value="0"/>
          <maxInclusive value="32768"/>
        </restriction>
      </simpleType> 

      The assert needs to execute before the prefix value is used as a length. 

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated: