users@jaxb.java.net

Re: Multiple internal lists for xs:choice mapping?

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Tue, 16 Aug 2005 19:36:15 +0200

Hi.

> I have a schema with an element A which has a complexType using xs:choice as follows:
>
> <xs:element name="A">
> <xs:complexType>
> <xs:choice maxOccurs="unbounded">
> <xs:element ref="B"/>
> <xs:element ref="C"/>
> <xs:element ref="D"/>
> <xs:element ref="E"/>
> </xs:choice>
> <xs:attribute name="name" type="xs:string"/>
> <xs:attribute name="id" type="xs:string"/>
> <xs:attribute name="parent-name" type="xs:string"/>
> <xs:attribute name="parent-id" type="xs:string"/>
> </xs:complexType>
> </xs:element>
>
> Of course the generated Java code for ModelType contains code like:
>
> List getBOrCOrDOrE();
>
> What I would like to do is have 4 separate List objects for B, C, D, and E.
>
> e.g.
>
> List getBs();
> List getCs();
> List getDs();
> List getEs();
>
> Is this possible?

I don't think so. This type of mapping would loose ordering of elements.

Bye.
/lexi