Dennis Sosnoski <[EMAIL PROTECTED]> writes:

> Here's a sample from the JiBX build test cases:
>
>   <mapping name="myelement" class="simple.MyClass3">
>     <structure ordered="false" choice="true">
>       <value name="a" field="a" usage="optional"/>
>       <value name="b" field="b" usage="optional"/>
>       <value name="c" field="c" usage="optional"/>
>       <value name="d" field="d" usage="optional"/>
>     </structure>
>     <value name="e" field="e" usage="optional" format="char.string"/>

I notice that you marked all of the constituent choice values as
optional. I did fiddle around with this as well, but found that if I
mark all of them as optional, I've made myself vulnerable to accepting
a document with /none/ of the choice values present -- even though the
choice particle is supposed to mandate exactly one value being
present.

> Here's a corresponding XML:
>
> <myelement>
>   <b>The Answer</b>
>   <dimension width="4" height="6"/>
>   ...

What if your document lacks the "b" element? It would be accepted by
JiBX given your mapping above, but it would not be valid to your
schema -- assuming the choice particle is not optional in your schema.

> It may be that there's some strange error coming in from the nesting
> inside an abstract mapping, since that's the only thing that seems
> to be different.

Not too that in my schema, the choice particle is nested with a group
called "Gdevice-id". I found another message in the jibx-users archive
where you or maybe someone else said that JiBX didn't deal well
particles in groups, but it does look like your sample document above
produces the same effect I'm after: the first element (like your "b)
is one several choices, and it's immediately followed by a sibling
that's not part of the choice set (like your "dimension").

> Can you create a Jira and attach a test project to demonstrate the
> problem?

That will take some time, so perhaps first we can discuss the question
above about all the choice values being optional. If that's how it has
to work in JiBX, then no fix may be required -- unless you're
interested in tightening the validation to require one and only one
value for a choice particle.

It's good to see you back posting here. I was getting worried that you
had abandoned the JiBX project.

-- 
Steven E. Harris


-------------------------------------------------------------------------
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