users@jaxb.java.net

jaxb2 and idref

From: Francois Le Fevre <flefevre_at_genoscope.cns.fr>
Date: Fri, 11 May 2007 11:34:54 +0200

Dear all,

I have still a difficluty using idref with jaxb2

I have created a xml schema where for instance a list of B and A object
where B contains a reference to A via idRef. ( see at the end of the
email )
But the java generated code is:
public class B {

   @XmlElementRef(name = "a", type = JAXBElement.class)
   protected List<JAXBElement<Object>> a;
...
}

And i would like to precise a "protected List<A> a;" and not "protected
List<JAXBElement<Object>> a;"
do i need to use something different from idref ... keyref ... or add
annotation inforamtion ??

Thanks for all your help.

Francois

=====
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
   <xs:element name="Test">
       <xs:annotation>
           <xs:documentation>Comment describing your root
element</xs:documentation>
       </xs:annotation>
       <xs:complexType>
           <xs:sequence>
               <xs:element name="a" type="A" minOccurs="0"
maxOccurs="unbounded"/>
               <xs:element name="b" type="B" minOccurs="0"
maxOccurs="unbounded"/>
           </xs:sequence>
       </xs:complexType>
   </xs:element>
   <xs:complexType name="A">
<xs:sequence>
           <xs:element name="id" type="xs:ID"> </xs:element>
</xs:sequence>
   </xs:complexType>
   <xs:complexType name="B">
       <xs:sequence>
           <xs:element name="a" type="xs:IDREF" minOccurs="0"
maxOccurs="unbounded"> </xs:element>
       </xs:sequence>
   </xs:complexType>
</xs:schema>

-- 
Francois Le Fevre
Bioinformatics Engineer
Computational Systems Biology Group
Genoscope
Tél. : (+33) 1 60 87 45 83
Web : http://www.genoscope.cns.fr/bioinfo