[DFDL-WG] clarification needed: setVariable - executes before or after framing of the element/model group

Mike Beckerle mbeckerle.dfdl at gmail.com
Tue Sep 6 15:47:14 EDT 2016


Perhaps this is a minor clarification I need. Perhaps this is obvious.

The language you excerpted probably pre-dates the data syntax grammar in
the spec.

What grammar regions does point (4) " dfdl:sequence or dfdl:choice or
dfdl:group following property scoping rules" apply to?

dfdl:group for group references are non-issue since those turn into
sequence or choice.

I think the answer is perhaps, obvious in retrospect.: it is the Sequence
or Choice regions, and for simple types it is SimpleElement (not
SimpleContent) for complex elements it is ComplexElement (not
ComplexContent). That way it is clear that in every case, framing,
alignment regions etc., are included.

So for sequences, what textually appears above/before the dfdl:setVariable
statement is framing properties of the sequence (in short form, or in long
form if the dfdl:sequence element is placed above the setVariable
statemnts). Those can use runtime-valued expressions which refer to the
variable, and will see the variable after the set has executed.

This is disconcerting only because of the lexical ordering mis-match with
the order of execution.

However, the same is true for asserts and discriminators using expressions.
Those execute after the setVariables, no matter where they appear in
lexical order vis a vis the setVariable statement annotations.

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>


On Tue, Sep 6, 2016 at 12:58 PM, Steve Hanson <smh at uk.ibm.com> wrote:

> Mike
>
> From section 9.5:
>
> For sequences, choices and group refs:
>
> 1.        dfdl:discriminator or dfdl:assert(s) with testKind 'pattern'
> (parsing only)
>
> 2.        dfdl:newVariableInstance(s) - in lexical order, innermost schema
> component first
>
> 3.        dfdl:setVariable(s) - in lexical order, innermost schema
> component first
>
> 4.        dfdl:sequence or dfdl:choice or dfdl:group following property
> scoping rules
>
> 5.        dfdl:discriminator or dfdl:assert(s) with testKind 'expression'
> (parsing only)
>
>
> This says that a setVariable on a group is processed before the format
> annotations of the group, so your example would be allowed.
>
> For discriminators and asserts, when they are executed depends of the
> testKind. If 'pattern' they are executed first. If 'expression' they are
> executed last.
>
> All seems clear to me - am I missing some subtlety somewhere?
>
> Regards
>
> Steve Hanson
> *IBM Integration Bus*
> <http://www-03.ibm.com/software/products/en/ibm-integration-bus>,
> Hursley, UK
> Architect, *IBM DFDL*
> <http://www.ibm.com/developerworks/library/se-dfdl/index.html>
> Co-Chair, *OGF DFDL Working Group* <http://www.ogf.org/dfdl/>
> *smh at uk.ibm.com* <smh at uk.ibm.com>
> tel:+44-1962-815848
> mob:+44-7717-378890
>
>
>
> From:        Mike Beckerle <mbeckerle.dfdl at gmail.com>
> To:        "dfdl-wg at ogf.org" <dfdl-wg at ogf.org>
> Date:        02/09/2016 16:56
> Subject:        [DFDL-WG] clarification needed: setVariable - executes
> before or after framing of the element/model group
> Sent by:        "dfdl-wg" <dfdl-wg-bounces at ogf.org>
> ------------------------------
>
>
>
>
> The spec defines where setVariable executes as a statement relative to
> element processing and model-group processing.
>
> Question is: what does element and model group processing mean: the value
> region of the element, the content region of the element,  or the whole
> element including all framing?
>
> So, for an element, spec says that setVariables run after the element.
>
> Rhetorical question: Does "after" mean after the terminator (including any
> expression for the terminator) has completed?
>
> Yes, because otherwise a element could contain the value of its own
> terminator, and that wouldn't work for lengthKind='delimited' as you would
> need the value to get the terminator to parse the value.
>
> So 'after' has to mean after the terminator, meaning all framing, and any
> other expression that can affect the length or interpretation in forming
> the element.
>
> For a model group, the spec says that setVariables run before the model
> group.
>
> So, can a sequence carry a set-variable that sets a variable value that is
> then used in the initiator property of that very sequence?
>
> E.g.,
>
> <xs:sequence dfdl:initiator="{ $init }">
>    <xs:annotation><xs:appinfo ...>
>        <dfdl:setVariable ref="init">{ ../someplace/else
> }</dfdl:setVariable>
>   </xs:appinfo></xs:annotation>
>    ..... reset of sequence
> </xs:sequence>
>
> If this is not allowed for the initiator, what about for the terminator or
> separator, or outputNewLine or encoding or any other property that
> affects the syntax of the model group?
>
> What about discriminators/asserts. Do those run before the sequence's
> initiator is matched, or after? E.g., can a discriminator indicate "true",
> but then the initiator fails to match?
>
> When unparsing, you don't execute discriminator/assert at all, so no
> guidance there.
>
> Maybe this is clear already, but I am not sure if setVariables should run
> before any framing of a model group, or after the framing, but before the
> content region, or before the value region.
>
> ...mikeb
>
> Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology |
> *www.tresys.com* <http://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>
> --
>  dfdl-wg mailing list
>  dfdl-wg at ogf.org
>  https://www.ogf.org/mailman/listinfo/dfdl-wg
>
>
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ogf.org/pipermail/dfdl-wg/attachments/20160906/4b1ca80f/attachment-0001.html>


More information about the dfdl-wg mailing list