users@jaxb.java.net

Re: binding to other classes than the generated classes

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Fri, 29 Aug 2008 21:14:55 +0200

On 8/29/08, optimusprime1982 <c.krenn_at_campus02.at> wrote:
>
> I get data from a webservice that i I have to save into database, because
> afterwards the data is getting altered. So i copied the complete structure
> to build my own domain model. The structure is very deep, and it's annoying
> to map all files from AOffering to BOffering and so own.
> So I tried to change the also generated jaxb Axxxxx-files from @XmlType(name
> = "AOffering") to @XmlType(name = "BOffering") and I assumed that jaxb
> should now map the xml into Axxxxx classes because of the xsi:type in there
> -> ...<Offering xsi:type="ns2:BOffering">... .
>
> But jaxb ignores the xmltype name and instantiates objects with the name of
> the class.
>

The argument of @XmlType is a schema type name, not of a Java class.

But I don't quite get the purpose of the whole fiddling with those
types. Why do you want to duplicate all the Java types (Axxxxx to
Bxxxxx)?

Wolfgang

> Is there a possibility to change this behavior?
>
> Thanks in advance
>
> Best wishes
> Chris
>
>