users@jaxb.java.net

Re: jaxb2 and idref

From: Francois Le Fevre <flefevre_at_genoscope.cns.fr>
Date: Mon, 21 May 2007 10:38:57 +0200

Dear Kohsuke

Thanks you for the quick answer. I do understand that there is no way
tochange the behaviour with JAXBElement<Object> / idref. But perhaps, I
don't use the good tools "idref/id"

In a general manner, how to you precise the java type of a list in a xml
schema?
I really want to have an xml schema where:

    * the root element contains different xml element defining in a
      complex-type
    * and then, be able to reference in my elements other elements
      defines at root

Is Id/idref mecanism the good one? ( what for keyref? xsi:type?)
Is there a way to add annotation in the xml schema to precise the type
of the element list?

Thanks for the information complement.

Francois
> Francois Le Fevre wrote:
>> 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.
>
> To differenciate between IDREFS and list of elements whose type is ID,
> JAXBElement is necessary.
>
> I'm sympathetic, but there's no way around this.
>


-- 
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