I took an action from the last meeting to document the scenarios relating to nils and defaults, with particular reference to groups that have a separator.
The number of combinations is large, but I'll try to do this in an organised way. The variables are:

- separatorPolicy ( required / suppressed / suppressedAtEnd )
- element has a zero-length representation / element is missing from the data stream
- user wants ( nil / default value / no element ) in the infoset
- element is simple / complex

Some ground rules:
* A group member is missing if the group has initiatedContent="true" and its initiator is not found.
* A group member is missing if the group ends before the member has been parsed.
* A group member cannot be missing if its parent group has separatorPolicy="required"

Scenario 1: Fixed-length elements with initiators, no separators

ONE:oneTWO:twoTHREE:three<END>
All members are present.

ONE:oneTHREE:three<END>
'Two' is missing, and is defaulted if required.

ONE:oneTWO:two<END>
Group ends early. 'Three' is missing, and is defaulted if required.

Scenario 2: Variable-length elements with initiators and infix separators
Note how the presence of separators allows a zero-length representation - not possible in scenario 1

ONE:one,TWO:two,THREE:three<END>
All members are present.

ONE:one,THREE:three<END>
If separatorPolicy='suppressed; then 'Two' is missing, and is defaulted if required.
If separatorPolicy!='suppressed' then a processing error is reported.

ONE:one,,THREE:three<END>
If separatorPolicy='required' then 'Two' has a zero-length representation, zero-length is interpreted as 'missing' and 'Two' defaulted if required
If separatorPolicy!='required' then 'Two' is present with a zero-length representation. If 'Two' cannot be zero-length, then it is a processing error.
The above rules can be discussed, but I believe they have merit. The key point is that 'required' and 'suppressed' really do imply different things about a zero-length member. I'm aware that there may be other lengthKinds where zero-length needs to be interpreted as 'missing'. I think 'pattern' would be one example of that. Not so sure about 'prefixed' and 'explicit-when-length-is-a-DFDL-expression'
Note that the next example is the most likely use of defaulting when separatorPolicy='suppress"

ONE:one,TWO:,THREE:three<END>
'Two' has a zero-length content region, and is defaulted if missingValueInitiatorPolicy="required".

ONE:one,TWO:two,<END>
If separatorPolicy='required' then 'Three' has a zero-length representation, zero-length is interpreted as 'missing', and 'Three' is defaulted if required
If separatorPolicy='suppressed' then 'Three' has a zero-length representation.  If 'Three' cannot be zero-length, then it is a processing error.

ONE:one,TWO:two<END>
If separatorPolicy='required' then it is a processing error.
If separatorPolicy!='required' then the group ends early. 'Three' is missing, and is defaulted if required.

Other points:

- I think the name 'missingValueInitiatorPolicy' is confusing - the name implies that it is about missing items, and about the presence/absence of the value only
The role of this property is actually
a) to tell the parser how to recognize a required element that is not missing from the data stream, but does need to be defaulted
b) to tell the unparser how to serialize a required element that is missing from the infoset ( or one that is present in the infoset without a value? )
I think the old name 'defaultValueInitiatorPolicy' conveys it a little more accurately (and is consistent with nilValueInitiatorPolicy ), but there were reasons for changing the name. Unfortunately I don't remember what they were.

- OccursCountKind: I'm assuming that it is intended to allow variable-length arrays in formats where the array length cannot easily be detected in other ways. Occurences must be contiguous ( so don't try using it for occurrences within an unordered group ). If the data stream ends before all occurences have been parsed, it is a processing error.


regards,

Tim Kimber, Common Transformation Team,
Hursley, UK
Internet:  kimbert@uk.ibm.com
Tel. 01962-816742  
Internal tel. 246742






Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU