users@jaxb.java.net

Re: need some explanation on jaxb generated code

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Thu, 25 Sep 2008 09:08:58 +0200

Sorry, I didn't look closely enough. The Java code is not due to
mixed="true".
(In that case, the code would be similar, with a List<?> content, but that
would have an annotation XmlMixed.)

The reason that would make JAXB generate the Java class as shown could be
the duplication of one of the child elements of the complex type - same tag,
same type.

-WL

On 9/24/08, Wolfgang Laun <wolfgang.laun_at_gmail.com> wrote:
>
> You don't, by any chance, have an attribute mixed="true" in the
> <xs:complexType name="SaisieActeMessage">?
>
> If that's so, then you have XML content that cannot be mapped to a simple
> set of unordered class fields, plus one for content. Processors of your
> input action message expect to obtain the sub-elements and the chunks (!) of
> content one by one, in the order of their appearance.
>
> Cheers
> Wolfgang
>
> On 9/24/08, 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 ?
>>
>
>