users@jaxb.java.net

Re: Possible bug and workaround

From: Joe Fialli <joseph.fialli_at_sun.com>
Date: Wed, 19 Mar 2003 09:28:28 -0500

Han Ming Ong wrote:

> Given a simple schema segment below
>
> <xs:element name="relation">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="desc" type="string"/>
> <xs:element ref="role" />
> <xs:element ref="role" />
> <!--- **** ---->
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
> <xs:element name="role">
> <xs:complexType>
> <xs:sequence>
> <xs:element ...
> ...
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
> JAXB will simply generate the following interface for RelationType:
>
> public interface RelationType {
> java.util.List getContent();
> }
>
> Hardly very useful right?
>
> It should at least generate
>
> public interface RelationType {
> java.lang.String getDesc();
> void setDesc(java.lang.String value);
>
> java.util.List getRole();
> ...
> ...
> }
>
> In case anyone is interested in the workaround, I deleted the 2 roles
> element and changed the line at <!---- **** ----> to
>
> <xs:element minOccurs="2" maxOccurs="2"
> ref="ejb-relationship-role" />
>
> Incidentally, is this the best forum to report bugs?


Thanks for your feedback

Your request is more of a RFE (request for enhancement) than a bug.

An alternative workaround to changing the schema is to customize one of
the two
elements to have a different jaxb property name with the <jaxb:property
name> customization.
Once all the children elements in a sequence have a unique name, the
databinding will revert to binding as you desire.

To answer your question on the correct place to query and report bugs,
try out http://developer.java.sun.com/developer/bugParade/index.jshtml.
Category: Java Architecture for XML Binding (JAXB-XSD)
You can search existing bugs/rfe for JAXB in bugparade by keyword
or bugid (if you know one.)

Thanks,
-Joe Fialli, Sun Microsystems

>
>
> thanks, Han Ming