[DFDL-WG] clarification - dfdl:choiceDispatchKey does not specify forward-reference restrictions

Mike Beckerle mbeckerle.dfdl at gmail.com
Tue Aug 29 14:29:55 EDT 2017


The test expressions in dfdl:assert and discriminator both specify that
they may refer to the value of this element or its descendents.

Hence, a test can refer to complex content down and inside the element.

Most other properties can refer only backward, and not to the value of the
element on which they appear (as their values are likely needed in order to
parse that data and get an element at all.)

However for dfdl:choiceDispatchKey, there is no description of what the
expression may refer to.

There is a common use case for choices which is where the fields(s) that
the choiceDispatchKey  wants to inquire about are found at a fixed position
inside each of the choice branches. Programming languages use offsets to
reach forward into the data to retrieve these.

The only way this can be expressed in DFDL, without running into problems
with polymorphic path steps, requires such elements to appear
as children of a sequence that is the root of each branch.

So for example:

<element name="msg">
   <complexType>
     <choice dfdl:choiceDispatchKey="{ ../msg/key }">
        <sequence dfdl:choiceBranchKey="1">
             ... stuff ...
             <element name="key" ..../>
            ... more stuff...
       </sequence>
        <sequence dfdl:choiceBranchKey="3">
             ... stuff ...
             <element name="key" ..../>
            ... more stuff...
       </sequence>
      .... and so on ...
   </choice>
  </complexType>
</element>

This uses paths that reach down into the inside of each branch to obtain
the key element.

So is this legal, or not?




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/20170829/18979e59/attachment.html>


More information about the dfdl-wg mailing list