This is a static archive of the previous Open Grid Forum Redmine content management system saved from host redmine.ogf.org file /issues/316 at Thu, 03 Nov 2022 01:52:45 GMT document #316: Action 242 part 1 - valueLength and contentLength clarifications - DFDL WG - Open Grid Forum

document #316

Action 242 part 1 - valueLength and contentLength clarifications

Added by Michael Beckerle over 6 years ago. Updated about 2 years ago.

Status:closed Start date:08/02/2016
Priority:Normal Due date:
Assignee:- % Done:

100%

Category:-
Target version:DFDL v1.0
Document Type:Proposed Recommendation

Description

(From the email thread in discussion of Action 242. There are 3 separate issue trackers associated with Action 242's resolution. This is the first one.)

1) we need the concept of valueLength of a complexType which excludes the ElementUnused region, so that contentLength of a complexType can include the ElementUnused region.

The example that motivates this is from PCAP where there are length fields that aren't the exact length while unparsing but contain other factors:

<element name="len" type="xs:int" dfdl:outputValueCalc="{ fn:max(dfdl:valueLength(../ctElem, 'bytes'), 60) }" .../>
...
<element name="ctElem" dfdl:length="{ ../len }" .../>

In the above, we have a complex type element that has a minimum length of 60. So when unparsing if the actual length of the choice/sequence that is the model group of the ctElem is of length less than 60, we need to fill out the ElementUnused region of the DFDL grammar so as to achieve the min length of 60 bytes.

If the dfdl:outputValueCalc of the len element was to call dfdl:contentLength, then we would have a circularity.

Erratum 5.18 clarifies that length expressions are evaluated when unparsing to produce the target length that is used for pad/fill.

This concept must be extended to complex types so that it also addresses the ElementUnused region that can follow the model group of a complex type.

To clarify all this I suggest the DFDL data grammar must be changed as follows:

ComplexNormalRep = LeftFraming PrefixLength ComplexContent RightFraming # Unchanged. Just here for context
ComplexContent = ComplexValue ElementUnused
ComplexValue = Sequence | Choice

The above change basically moves ELementUnused out of the ComplexNormalRep production into a separate ComplexContent production, and distinguishes ComplexValue from ComplexContent.

With the above grammar rule changes, I believe the spec as modified for Erratum 5.18 will be correct. (Everyplace where lengthKind explicit is lumped in with prefixed etc must be broken out, as it is a different case. )

2) Spec says escapeCharacter, escapeBlockStart, and excapeBlockEnd contribute to the content length of an element. (Note: escapeEscapeCharacter is missing this stipulation and should be made consistent.)

However, I believe this is incorrect. These all contribute to the value length, that is to say, they appear within the "SimpleValue | NilLogicalValue" region of the grammar.

3) Definition of dfdl:valueLength must be changed to specify that it returns the length of the ComplexValue region for complex types, and excludes any filling of the ElementUnused region.

The definition of dfdl:contentLength is acceptable as is.


Related issues

related to DFDL WG - document #196: dfdl:valueLength function - unclear what it does closed 09/26/2013

History

Updated by Michael Beckerle almost 5 years ago

  • Target version set to DFDL v1.0

Updated by Michael Beckerle about 3 years ago

  • Status changed from submitted to accepted

Erratum 5.44

Updated by Michael Beckerle about 2 years ago

  • Status changed from accepted to closed
  • % Done changed from 0 to 100

(Other formats not available in this archive.

This is a static archive of the previous Open Grid Forum Redmine content management system saved from host redmine.ogf.org file /issues/316 at Thu, 03 Nov 2022 01:52:47 GMT