Also, explicit choice lengths aren't implemented yet. The
dfdl:choiceLengthKind and dfdl:choiceLength properties are currently
ignored. There is a pull request to add the support, but it's needs some
changes before it can be merged.

- Steve

On 6/3/19 2:40 PM, Beckerle, Mike wrote:
> The most common use cases come from COBOL REDEFINES where a typical union of 
> record types is made the fixed length of the longest one. Everything in such 
> data is typically fixed length. These are also almost always going to have 
> dfdl:choiceDispatchKey - because it is typical that there is a field to 
> distinguish the various record formats.
> 
> 
> C language unions have the same behavior, but those aren't often used to 
> define 
> record structures in files, whereas in COBOL they almost always ARE used to 
> define record structures in files.
> 
> 
> 
> --------------------------------------------------------------------------------
> *From:* Costello, Roger L. <coste...@mitre.org>
> *Sent:* Monday, June 3, 2019 1:54:43 PM
> *To:* users@daffodil.apache.org
> *Subject:* Got a good use case for dfdl:choiceLengthKind?
> 
> Hello DFDL community,
> 
> I am trying to understand choiceLengthKind. Do you have a compelling use case 
> for it?
> 
> I tried the following for dfdl:choiceLengthKind="explicit"
> 
> The input contains a person’s name. If the name is less than 10 characters, 
> then 
> it’s just the firstname. Otherwise, it’s the firstname and last name.
> 
> <xs:elementname="input">
> <xs:complexType>
> <xs:choicedfdl:choiceLengthKind="explicit">
> <xs:elementname="firstname"type="xs:string"dfdl:choiceLength="10"/>
> <xs:elementname="firstname-lastname"type="xs:string"dfdl:choiceLength="20"/>
> </xs:choice>
> </xs:complexType>
> </xs:element>
> 
> For reasons I do not understand, the first choice (the firstname element) is 
> always selected.
> 
> This input:
> 
> John
> 
> Produces this XML:
> 
> <input>
> <firstname>John</firstname>
> </input>
> 
> And this input:
> 
> John Alexander Smith
> 
> Produces this XML:
> 
> <input>
> <firstname>John Alexander Smith</firstname>
> </input>
> 
> Why is that?
> 
> /Roger
> 

Reply via email to