users@jaxb.java.net

Naming when creating a list of complex elements

From: ofira shaer <oshaer_at_gmail.com>
Date: Thu, 16 Jul 2009 11:25:49 +0300

Hi.


I am trying to define a list of complex elements, specifcally an Action that
contains some Fields.

My schema definitions are as follows:




<xs:complexType name="Field">
*

<xs:sequence>
*

<xs:element *ref*="FieldName"/>

<xs:element name="FieldValue" type="xs:string"/>
*

</xs:sequence>
*

</xs:complexType>


<xs:complexType name="Action">

*<xs:sequence>*

<xs:element name="ActionName" type="ActionName"/>

<xs:element name="ActionCode" type="ActionCode"/>

<xs:element name="FieldsList" type="Field" minOccurs="0"
maxOccurs="unbounded"/>
*

</xs:sequence>
*

</xs:complexType>


Jaxb maps this into an Action class that has a getFieldsList() method,
returning a List<Field> , which is exactly what i want.

The problem is that in the resulting XML, I get this:


<Action>

       <FieldsList>

<FieldName>