Here is what I am expecting:

<details>
   <music>
        <album>
             ....details....
        </album> 
    </music>
</details>

or  

<details>
   <music>
        <track>
             ....details....
        </track> 
    </music>
</details>

Basically, <music> is expected to have either album or track.

Here is a snippet from my schema:

        <element name="details">
                <complexType>
                        <sequence>
                                <choice>
                                    <element ref="tns:movie" maxOccurs="1" 
minOccurs="0"></element>
                                    <element ref="tns:music" maxOccurs="1" 
minOccurs="0"></element>
                                </choice>
                                <element ref="tns:link" maxOccurs="unbounded" 
minOccurs="0"></element>
                        </sequence>
                </complexType>
        </element>
   .
   .
   .
    <element name="music">
        <complexType>
            <choice>
                <element ref="tns:album" maxOccurs="1"
minOccurs="0"></element>
                <element ref="tns:track" maxOccurs="1"
minOccurs="0"></element>
            </choice>
        </complexType>
    </element>

The binding for music element is here:

  <mapping name="music"
class="com.mediaslate.og.schema.xml.itemdetails.Music">
    <namespace uri="http://www.mediaslate.com/itemdetail";
default="elements"/>
    <structure field="album" usage="optional"
map-as="com.mediaslate.og.schema.xml.itemdetails.Album"></structure>
    <structure field="track" usage="optional"
map-as="com.mediaslate.og.schema.xml.itemdetails.Track"></structure>
  </mapping>  


Now when I set both Album and track in the music, it generates both
elements... I was expecting an error...

(Same is true for the details element where I am expecting either music or
movie)

Any help to resolve this issue will be highly appreciated.


Rajan


-- 
View this message in context: 
http://www.nabble.com/JiBX-and-XSD%3AChoice---Can%27t-get-to-work...-tf3765334.html#a10644263
Sent from the jibx-users mailing list archive at Nabble.com.


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