Hi,

I have a web service that allows this kind of elements in the request (simplified):

Code:
<xs:complexType name="Foo">
    <xs:all>
        <xs:element name="A" type="typeA"/>
        <xs:element name="B" type="typeB"/>
        <xs:element name="C" type="typeC"/>
    </xs:all>
</xs:complexType>
We use JAXB to automatically compile the XSDs and generate all necessary Java classes.
Now I have to allow operations on the elements of this type:

Code:
<xs:complexType name="Foo">
    <xs:all>
        <xs:element name="A" type="typeA"/>
        <xs:element name="D" type="typeD"/>
    </xs:all>
</xs:complexType>
But also I must allow the client code to continue using the legacy objects as described in the first listing.
How do I design the schema element to allow both options? I have been trying to do something like this:

Code:
<xs:complexType name="Foo">
    <xs:all>
        <xs:element name="A" type="typeA"/>
        <xs:choice>
            <xs:all>
                <xs:element name="B" type="typeB"/>
                <xs:element name="C" type="typeC"/>
            </xs:all>
            <xs:element name="D" type="typeD"/>
        </xs:choice>
    </xs:all>
</xs:complexType>
But then the XSD compiler fails because you cannot have xs:all inside xs:choice.
I've read about substitution groups too, but that seems to apply only to element names.
What's the right way to go here?
Thanks.