users@jaxb.java.net

Re: need some explanation on jaxb generated code

From: Felipe Gaúcho <fgaucho_at_gmail.com>
Date: Wed, 24 Sep 2008 10:00:56 +0200

JAXB also generates an ObjectFactory, and the proper way to
instantiate your objects is through this factory...



On Wed, Sep 24, 2008 at 9:40 AM, nicolas de loof <nicolas_at_apache.org> wrote:
> Hello, I'm an apache CXF user, and I get a strange behaviour with JAXB
> binding. CXF user list forwarded me here for this :
> My (WSDL) schema defines a complextype :
> <xs:complexType name="SaisieActeMessage">
> <xs:sequence>
> <xs:element name="adressefacturation" type="tns:Adresse"/>
> <xs:element name="adresselivraison" type="tns:Adresse"/>
> <xs:element name="contact" type="tns:MoyenDeContact"/>
> [~10 more elements] ...
> I expected the generated Java class to define attributes
> "adressefacturation", "adresselivraison", "contact" ..., as it does for many
> other types in my WSDL, but I get :
> @XmlAccessorType(XmlAccessType.FIELD)
> @XmlType(name = "SaisieActeMessage", propOrder = {
> "content"
> })
> public class SaisieActeMessage {
> @XmlElementRefs({
> @XmlElementRef(name = "adresselivraison", namespace = "http://foo",
> type = JAXBElement.class),
> @XmlElementRef(name = "adresseFacturation", namespace =
> "http://w foo", type = JAXBElement.class),
> @XmlElementRef(name = "contact", namespace = "http://foo", type =
> JAXBElement.class),
> ..... })
> protected List<JAXBElement<?>> content;
>
> Is this REALLY what is expected ? Is there no way to have something more
> developer-compliant ?