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.