I suggested the use of an escape scheme to handle this
Yes, you did. :-) You have correctly perceived the original intentions of these initiators/discriminators; however, in practice, the escape characters never appear, so they are genuinely superfluous, thus I don’t think the escape scheme approach is best.
The 'sequence' is more flexible as it gives you the possibility of hiding the brackets from the infoset using dfdl:hiddenGroupRef.
This is helpful, and I’ll try it this way.
Thank you!
From: Steve Hanson [mailto:smh@uk.ibm.com]
Sent: Monday, March 11, 2013 5:42 AM
To: Cranford, Jonathan W.
Cc: dfdl-wg@ogf.org; dfdl-wg-bounces@ogf.org; Garriss Jr., James P.
Subject: Re: [DFDL-WG] Optional Initiator and Terminator?
In an earlier email exchange on this subject, I suggested the use of an escape scheme to handle this, assuming that the { } are either both absent or both present, using properties escapeKind 'escapeBlock', escapeBlockStart '{', escapeBlockEnd '}'. The disadvantage of this approach is when serializing - you need to set property generateEscapeBlock to 'always' or 'whenNeeded' - there is no setting for 'remember what it was when parsed'. That may or may not be a requirement here.
If an escape scheme is not appropriate, then whether the 'choice' or 'sequence with optionality' approach is best is really up to you. It all depends on how you want to manipulate the infoset subsequently. The 'sequence' is more flexible as it gives you the possibility of hiding the brackets from the infoset using dfdl:hiddenGroupRef.
To Jonathan's point, if the { } are either both absent or both present. you can place a dfdl:assert on the sequence which throws an error if the brackets are unbalanced.
Regards
Steve Hanson
Architect, Data Format Description Language (DFDL)
Co-Chair, OGF DFDL Working Grouphttp://www.ogf.org/dfdl/
IBM SWG, Hursley, UK
smh@uk.ibm.commailto:smh@uk.ibm.com
tel:+44-1962-815848
From: "Cranford, Jonathan W."