users@jaxb.java.net

Possible bug and workaround

From: Han Ming Ong <hanming_at_mac.com>
Date: Tue, 18 Mar 2003 17:07:10 -0800

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, Han Ming