Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JAXB marshalling attributes of an element in its parent element

843834Dec 17 2002 — edited Nov 19 2008
I am getting some strange results using JAXB to marshall instances of a schema containing the following complexType definition:

<xs:complexType name="restrictionType">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="literal" type="literalType"/>
<xs:element name="range" type="rangeType"/>
</xs:choice>
<xs:attribute name="description" type="xs:string"/>
</xs:complexType>
<xs:complexType name="literalType">
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="rangeType">
<xs:attribute name="minValue" type="xs:string" use="required"/>
<xs:attribute name="maxValue" type="xs:string" use="required"/>
</xs:complexType>

Any 'literal' or 'range' objects I create and add to the 'restrictionType' are not written out as subelements. Instead their attributes are added to the 'restrictionType' element.

Has anyone else seen this behaviour?

Does anyone know if it is a bug, a mistake in my schema, or a mistake in my code ?


Cheers,


Simon Heinrich
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 17 2008
Added on Dec 17 2002
3 comments
321 views