discriminators near PoU or not
I thought this situation was worth discussing.
I have a bunch of messages. They all work like this:
<element name="messageName1">
<complexType>
<sequence>
<element ref="boilerplateElt1" minOccurs="0"/>
<element ref="boilerplateElt2" minOccurs="0"/>
<sequence dfdl:initiator="MSG1">
.... message specific elements go in here...
</sequence>
... optional trailing boilerplates go here
</complexType>
</element>
There are hundreds of those.
These all are used in this way:
<element name="topLevel">
<complexType>
<sequence>
<element name="message" minOccurs="1" maxOccurs="unbounded">
<complexType>
<choice>
<element ref="messageName1"/>
<element ref="messageName2"/>
....
</choice>
</complexType>
</element>
</sequence>
</complexType>
</element>
So, there are two points of uncertainty here. The choice, and the unbounded
array surrounding it.
For each message, it is not until the sequence carrying the initiator,
which is down inside the message structure, that we know for sure we've got
this kind of message.
So currently each message element is designed to be used ONLY in the above
context of two surrounding points of uncertainty, like so (same message
format as above
but with TWO discriminators added).
<element name="messageName1">
<complexType>
<sequence>
<element ref="boilerplateElt1" minOccurs="0"/>
<element ref="boilerplateElt2" minOccurs="0"/>
<sequence dfdl:initiator="MSG1">
<annotation>
Hi Mike,
I hit a similar scenario today with an EDIFACT message. There was an
optional array containing a bunch of initiated records. I used
'initiatedContent' for the array's sequence, but needed to add an extra
discriminator to stop an error from within one of the records from causing
the parser to backtrack and conclude that the array occurrence was not
there. Not easy to know where to put it.
One possibility is an 'all' attribute that says it resolves all points of
uncertainty that are in scope?
Regards
Steve Hanson
Architect, Data Format Description Language (DFDL)
Co-Chair, OGF DFDL Working Group
IBM SWG, Hursley, UK
smh@uk.ibm.com
tel:+44-1962-815848
From: Mike Beckerle
participants (2)
-
Mike Beckerle
-
Steve Hanson