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, Hursley, UK
Architect, IBM DFDL
Co-Chair, OGF DFDL Working Group
smh@uk.ibm.com
tel:+44-1962-815848
mob:+44-7717-378890
From: Mike Beckerle <mbeckerle.dfdl@gmail.com>
To: "dfdl-wg@ogf.org" <dfdl-wg@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@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
Please note: Contributions to the DFDL Workgroup's email discussions are subject to the OGF Intellectual Property Policy
--
dfdl-wg mailing list
dfdl-wg@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