On thinking this over, I realized it's more complex than we'd discussed. 
You're assuming that the <choice> has minOccurs='1', but it's equally 
valid for a choice to have minOccurs='0' (or maxOccurs > 1, but that 
equates to a collection). I suppose what I should really do is see if 
the binding <structure> with choice='true' is optional or required, and 
if it's optional use the current handling but if required throw an 
exception when no element matching the <choice> values is found.

So the small issue is not as small as it first looked, but I'll at least 
look into implementing this part of the choice handling to do what users 
would expect.

  - Dennis

Dennis M. Sosnoski
SOA and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117



Steven E. Harris wrote:
> Dennis Sosnoski <[EMAIL PROTECTED]> writes:
>
>   
>> It's true that the JiBX handling using choice="true" is not
>> completely equivalent to the schema <choice> particle, for either
>> marshalling or unmarshalling.
>>     
>
> As there's not much written about the xsd:choice support, could you
> add some detail -- either here or to the JiBX documentation on the Web
> -- as to the variations? The current documentation¹ has the following:
>
> ,----
> | This properly accepts only one of the alternative elements in the
> | group when unmarshalling, but will generate output with more than one
> | of the alternatives when marshalling if the values are present (but
> | see Verification hooks if you need to enforce the schema limits).
> `----
>
> The first clause is the subject of this thread: JiBX will accept no
> more than one of the alternatives /if they're all qualified as
> optional/, but it fails in that it will also accept zero of the
> alternatives.
>
> Are there any more equivalence differences to discuss not covered
> above?
>
>   
>> It looks like I could probably handle the no matching value present
>> case in the code generation without too much trouble
>>     
>
>   
>> if you want to enter an enhancement request Jira for this purpose
>> I'll see about adding it in for an upcoming release.
>>     
>
> That became JIRA issue JIBX-164:
>
>   http://jira.codehaus.org/browse/JIBX-164
>
>   
>> But 100% schema compatibility is definitely not a goal for JiBX 1.X,
>> and even for JiBX 2.0 I'm planning for better schema compatibility
>> rather than 100%.
>>     
>
> That's fair and is certainly your prerogative to set your own
> goals. This xsd:choice issue just looks like a case of intending to
> solve a particular problem and not noticing the small omission.
>
>
> Footnotes: 
> ¹ http://jibx.sourceforge.net/schema.html
>
>   

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to