[DFDL-WG] Discriminator example, alternative presentation
Steve Hanson
smh at uk.ibm.com
Fri Feb 15 05:46:34 CST 2008
Hi Simon
I see where you are coming from, but what you propose does not agree with
the spec (section 5.2.8). This states that use of 'fixed' is the
equivalent to dfdl:assert, not dfdl:discriminator. The difference between
the two is that encountering a dfdl:discriminator that evaluates to 'true'
in a choice branch switches off speculative parsing and a subsequent
processing error in that branch of the choice will not cause backtracking.
Using dfdl:assert does not provide that same semantic as a subsequent
processing error in that branch of the choice will cause backtracking . I
think all we need to do is change 5.2.8 to say that use of 'fixed' is
equivalent to dfdl:discriminator instead.
This semantic difference is the reason why we have both dfdl:assert and
dfdl:discriminator. As I pointed out on the call, it's been lost from
sections 7.3 and 7.4.
Here's 5.2.8 fyi.
The 'fixed' attribute is used:
to constrain the logical value of a required element while parsing.
to provide the logical value of a required element when unparsing when the
DFDL information set does not have a value for the element.
Note that a 'fixed' attribute can cause parsing to backtrack and try other
alternatives (see footnote). When data is encountered and it does not
match what is specified on the 'fixed' attribute, then it is a parse
error. That is, the fixed value is used for parsing, not only for
validation checking.
Footnote:
The semantics of fixed=?$$$? is as if it were translated into an assertion
and a dfdl:outputValueCalc property:
<element name=?x? type=?string? dfdl:outputValueCalc=?$$$? >
<annotation><appinfo>
<dfdl:assert>$. = ?$$$?</dfdl:assert>
</appinfo></annotation>
</element>
Assertion failure causes a processing error. The outputValueCalc fills in
the value when writing out data.
Regards, Steve
Steve Hanson
WebSphere Message Brokers
Hursley, UK
Internet: smh at uk.ibm.com
Phone (+44)/(0) 1962-815848
"Simon Parker" <simon.parker at polarlake.com>
Sent by: dfdl-wg-bounces at ogf.org
13/02/2008 17:43
To
<dfdl-wg at ogf.org>
cc
Subject
[DFDL-WG] Discriminator example, alternative presentation
Good evening.
As discussed at the conference, here's a more succinct way to express this
simple requirement.
Perhaps discriminator's motivating example should be more complex.
Comments and corrections welcome,
Simon
Simon Parker
Software Consultant
PolarLake
80 Harcourt Street
Dublin 2, Ireland
Phone +353 1 449-1075
Fax +353 1 449-1011
Web http://www.polarlake.com/
The information transmitted in this email is intended for the addressee
only and may contain confidential and/or privileged material. Any review,
retransmission, dissemination, reliance upon or other use of this
information by persons or entities other than the addressee is prohibited.
If you think, for any reason, that this message may have been addressed to
you in error, we would ask you to notify the sender immediately by return
email and delete the material. PolarLake Limited | Registered in Dublin,
Ireland | Number 357324 | Registered office as above.
--
dfdl-wg mailing list
dfdl-wg at ogf.org
http://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/20080215/cd674c70/attachment.html
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: discriminator.example.2.txt
Url: http://www.ogf.org/pipermail/dfdl-wg/attachments/20080215/cd674c70/attachment.txt
More information about the dfdl-wg
mailing list