[DFDL-WG] Tracker 299 and clarifications needed for dfdl:initiatedContent="yes" behaviors

Mike Beckerle mbeckerle.dfdl at gmail.com
Fri Jun 14 17:57:07 EDT 2019


Clarifications around initiatedContent="yes", choices,  and array elements

DFDL spec says in Section 15 that the root of a choice branch must not be
optional, meaning minOccurs cannot be 0.
This was questioned and resulted in tracker 299. The last comment there
suggests a need to revisit.

Here's the link: https://redmine.ogf.org/issues/299

The additional clarification I seek is whether I have properly understood
how dfdl:initiatedContent works in scenarios involving a combination of
choices with
array elements.

Consider this schema fragment:

<!-- Scenario 1 -->
<xs:choice dfdl:initiatedContent="yes">
   ....
   <xs:element name="foo" minOccurs="5" dfdl:initiator="foo:"
dfdl:occursCountKind="parsed".../>
   ...
</xs:choice>
When parsing this choice, if you encounter "foo:" in the data stream, that
discriminates two things: the choice itself, and the first occurrence of
the array foo. Both that choice branch (aka the array), and the first
occurrence of the array are "known to exist" per section 9.3.1.1.
Subsequent occurrences of additional foo elements with their initiators
"foo:" discriminate only the array occurrences. The minOccurs="5" is
ignored (except for validation)

<!-- Scenario 2 -->
<xs:choice dfdl:initiatedContent="yes">
   ....
   <xs:element name="foo" minOccurs="5" dfdl:initiator="foo:"
dfdl:occursCountKind="fixed".../>
   ...
</xs:choice>
When parsing this choice, if you encounter "foo:" in the data stream, that
discriminates the choice, but only for the first occurrence of element foo.
There is no point of uncertainty for the array. Subsequent occurrences of
element foo do not discriminate anything. There must be exactly 5
occurrences of element foo with initiators.

<!-- Scenario 3 -->
<xs:choice dfdl:initiatedContent="yes">
   ....
   <xs:element name="foo" minOccurs="5" dfdl:initiator="foo:"
dfdl:occursCountKind="expression".../>
   ...
</xs:choice>
When parsing this choice, if you encounter "foo:" that discriminates the
choice, but there are no points of uncertainty for the array. MinOccurs is
ignored (except for validation).
Subsequent occurrences of element "foo" do not discriminate anything.

<!-- Scenario 4 -->
<xs:choice dfdl:initiatedContent="yes">
   ....
   <xs:element name="foo" minOccurs="5" dfdl:initiator="foo:"
dfdl:occursCountKind="implicit".../>
   ...
</xs:choice>
When parsing this choice, if you encounter "foo:" that discriminates the
choice, but there is no point of uncertainty for the array until 5
occurrences have been parsed.
Once the occurs index is 6 then if you encounter "foo:" that discriminates
the occurrence of the array element foo, but the choice is already decided.

I raise these scenarios because they show that there is quite a bit of
complexity associated with dfdl:initiatedContent if viewed as a mechanism
for setting discriminators.
Sometimes more than one discriminator must be set, other times only one,
and sometimes it depends on the array index.

So the question is: Is my understanding of the above scenarios correct?


Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology |
www.tresys.com
Please note: Contributions to the DFDL Workgroup's email discussions are
subject to the OGF Intellectual Property Policy
<http://www.ogf.org/About/abt_policies.php>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ogf.org/pipermail/dfdl-wg/attachments/20190614/996b3573/attachment.html>


More information about the dfdl-wg mailing list