users@jaxb.java.net

Re: jaxb with jersey, can unmarshal, but not marshal

From: John G. Lussmyer <Cougar_at_CasaDelGato.Com>
Date: Wed, 14 Sep 2011 15:46:15 -0700

On 9/14/2011 11:04 AM, Wolfgang Laun wrote:
> This is too abstract for me - please provide something tangible.
>
> Generally speaking, it's possible to have a complexType that's both a
> component (list element or scalar) of another object and a solitary
> document type.

Okay, here's a trimmed down example:

<xs:element name="Options">
<xs:complexType>
<xs:sequence>
<xs:element name="Option" type="Option" minOccurs="0"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:complexType name="Option">
<xs:sequence>
<xs:element name="OptionId" type="OptionIdentifier" minOccurs="1"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>

I have some API's that take/return an "Options" and some that
take/return a "Option".
I can't make "Option" an xs:element, since that means it can't be used
as a type in "Options".