views:

11

answers:

0

I have a schema that looks like

<xs:choice minOccurs="0" maxOccurs="unbounded">
    <xs:element name="a" type="a" />
    <xs:element name="b" type="b" />
</xs:choice>

XML Beans generates the two methods getAArray() and getBArray(), which return A and B elements separately, losing their ordering.

I tried to let types a and b extend the common type t:

<xs:complexType name="t">
    <!-- empty -->
</xs:complexType>

<xs:complexType name="a">
    <xs:complexContent><xs:extension base="t">
        <!-- stuff -->
    </xs:extension></xs:complexContent>
</xs:complexType>

<xs:complexType name="b">
    <xs:complexContent><xs:extension base="t">
        <!-- different stuff -->
    </xs:extension></xs:complexContent>
</xs:complexType>

so now generated interfaces A and B have the same superinterface T, but I don't get any additional method from xmlbeans.

How do I get a list of sorted T objects, from a xs:choice element? Or at least a list of sorted XMLObject objects, which I will cast later?