Hi
There is a problem that keeps puzzling me. I tried to google to find the reason and there is just none.
Therefore, I am not sure if somebody might know.
Say I have a schema like the following,
<xs:element name="api"> <xs:complexType> <xs:choice maxOccurs="unbounded"> <-------- <xs:element ref="a" minOccurs="1" /> <xs:element ref="b" minOccurs="1" /> <xs:element ref="c" minOccurs="1" />
CASE1: When the line pointed by the arrow is like
<xs:choice maxOccurs="unbounded">
JAXB "xjc -p SomePackageName -d . ...." would generate a variable in Api.java such as
protected List<Object> aOrBOrC;
CASE2: However, if I change it to
<xs:choice maxOccurs="1">
JAXB generates
protected A a; protected B b; protected C c;
My question is in CASE1, how do I retrieve the value of A, B, and C individually since it is only given
ONE variable although its a list of them. aOrBOrC can only be either a, b or c. What if my instance of
the xml contains values for all a, b, and c.
I would expect xjc to generate something like the following for CASE1.
protected List<A> a; protected List<B> b; protected List<C> c;