In that case I don't see the harm in the escape scheme approach, with generateEscapeBlock set to 'whenNeeded'. It makes your infoset much cleaner as you just have one simple element (instead of a local sequence with multiple child elements).

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:        "Garriss Jr., James P." <jgarriss@mitre.org>
To:        "dfdl-wg@ogf.org" <dfdl-wg@ogf.org>,
Date:        12/03/2013 13:42
Subject:        Re: [DFDL-WG] Optional Initiator and Terminator?
Sent by:        dfdl-wg-bounces@ogf.org




I suspect that it would be better to remove them, but it would be ok if they were not removed.
 
From: Steve Hanson [mailto:smh@uk.ibm.com]
Sent:
Tuesday, March 12, 2013 9:33 AM
To:
Garriss Jr., James P.
Cc:
dfdl-wg@ogf.org; dfdl-wg-bounces@ogf.org
Subject:
Re: [DFDL-WG] Optional Initiator and Terminator?

 
If you parse and then serialize, are you bothered whether the  { } are preserved from input to output?

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:        
"Garriss Jr., James P." <jgarriss@mitre.org>
To:        
"dfdl-wg@ogf.org" <dfdl-wg@ogf.org>,
Date:        
12/03/2013 12:33
Subject:        
Re: [DFDL-WG] Optional Initiator and Terminator?
Sent by:        
dfdl-wg-bounces@ogf.org





>
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 Group
IBM SWG, Hursley, UK

smh@uk.ibm.com
tel:+44-1962-815848



From:        
"Cranford, Jonathan W." <jcranford@mitre.org>
To:        
"Garriss Jr., James P." <jgarriss@mitre.org>, "dfdl-wg@ogf.org" <dfdl-wg@ogf.org>,
Date:        
08/03/2013 21:29
Subject:        
Re: [DFDL-WG] Optional Initiator and Terminator?
Sent by:        
dfdl-wg-bounces@ogf.org






I don’t know the answer to the DFDL portion of your question, but I can say your two workarounds aren’t equivalent. The latter will accept an initiator with no terminator, and vice versa (e.g., “{ data” and “data }”, while the former will not.


HTH,


Jonathan



From:
dfdl-wg-bounces@ogf.org [mailto:dfdl-wg-bounces@ogf.org] On Behalf Of Garriss Jr., James P.
Sent:
Friday, March 08, 2013 12:42 PM
To:
dfdl-wg@ogf.org
Subject:
[DFDL-WG] Optional Initiator and Terminator?


Is there a way to specify that an initiator/terminator pair is optional?


IOW, these are both valid:


{ data }

data


If not, which of these workarounds is better (and why)?


Choice

  DataWithInitiatorAndTeminator

 DataWithoutInitiatorAndTeminator


Or


Sequence

OptionalInitiator (0 to 1)

Data

OptionalTerminator (0 to 1)


These seem the same to me, but maybe there’s a reason why one is better.
--
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
--
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
--
 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