Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
<daf:defineFormat name="base64Format" >
    <dfdl:format layerTransform="base64_MIME" layerLengthKind="implicitboundaryMark" />
</dfdl:defineFormat>

...

Code Block
languagexml
<annotation><appinfo source="http://www.ogf.org/dfdl/">
  <dfdl:defineFormat name="compressed">
    <dfdl:format layerTransform="gzip" layerLengthKind="implicitexplicit" />
  </dfdl:defineFormat>
</appinfo></annnotation>

<sequence dfdl:ref="tns:compressed">
  <group ref="tns:compressedGroupContents" dfdl:layerLength="{...}" />
</sequence>

The above annotation means: when parsing this sequence, take whatever data layer is in effect, layer a gzip data layer on it, and use that until the end of the gzipped data - in this case until the gzip transform itself determines that the compressed data has endedlength expressed in the layerLength expression is reached.

If we need to determine or verify the length of the layered data, then we must encapsulate the layered sequence in an element so that a path expression can refer to it.

Code Block
languagexml
<annotation><appinfo source="http://www.ogf.org/dfdl/">
  <dfdl:defineFormat name="compressed">
    <dfdl:format layerTransform="gzip" layerLengthKind="implicitexplicit" />
  </dfdl:defineFormat>
</appinfo></annnotation>

<sequence>
  ...
  <element name="compressedPayloadLength" type="xs:int"
    dfdl:outputValueCalc='{ dfdl:contentLength(../compressedPayload, "bytes") }'/>

  <element name="compressedPayload" >
    <complexType>
      <sequence dfdl:ref="tns:compressed">
        <group ref="tns:compressedGroupContents" dfdl:layerLength="{ ../compressedPayloadLength }"/>
      </sequence>
    </complexType>
  </element>

  <sequence>
    <xs:annotation><xs:appinfo source="http://www.ogf.org/dfdl/">
       <dfdl:assert>{ compressedPayloadLength eq dfdl:contentLength(compressedPayload, "bytes") }</dfdl:assert>
    <appinfo></annotation>
  </sequence>
  ....
</sequence>

...