XML Schema choice and axis

Discussion in 'XML' started by DayCoder, Aug 6, 2007.

  1. DayCoder

    DayCoder Guest

    In my schema file, I have defined a choice as follows:

    <xs:complexType name="myChoicesType">
    <xs:choice>
    <xs:element name="choice1" type="xs:string/>
    <xs:element name="choice2" type="xs:string"/>
    <xs:element name="choice3" type="xs:string"/>
    </xs:choice>
    </xs:complexType>

    When a client using axis creates an instance document and chooses
    choice1, axis is doing the following:

    <choice1>blah...blah..blah></choice1>
    <choice2 nil="true"/>
    <choice3 nil="true"/>

    Why is axis including choice2 and choice3 in the instance document
    with the nillable attribute set? Is it possible to not have it
    include choices that are left out.
    DayCoder, Aug 6, 2007
    #1
    1. Advertising

  2. Hi,

    DayCoder <> writes:

    > In my schema file, I have defined a choice as follows:
    >
    > <xs:complexType name="myChoicesType">
    > <xs:choice>
    > <xs:element name="choice1" type="xs:string/>
    > <xs:element name="choice2" type="xs:string"/>
    > <xs:element name="choice3" type="xs:string"/>
    > </xs:choice>
    > </xs:complexType>
    >
    > When a client using axis creates an instance document and chooses
    > choice1, axis is doing the following:
    >
    > <choice1>blah...blah..blah></choice1>
    > <choice2 nil="true"/>
    > <choice3 nil="true"/>


    Seems like a bug in Axis. This XML is not even valid per your
    schema. I suggest that you report this to the Axis developers.


    -boris

    --
    Boris Kolpackov
    Code Synthesis Tools CC
    http://www.codesynthesis.com
    Open-Source, Cross-Platform C++ XML Data Binding
    Boris Kolpackov, Aug 7, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page