Hi Liehann,
but I think that using a combination of the 'container' attribute and a
'location' attribute might give you what you want. Iow, try setting
location to a value of 'item' for the names fiel dmapping, and set
container to a value of 'false'. I am not sure about the correct value
for the container attribute, though.
Werner
Liehann Loots wrote:
> Hi,
>
> I'm trying to marshall a collection and am having some trouble getting
> the output I want.
>
> Say my class looks like this:
>
> class Stuff {
> public ArrayList<String> names;
> }
>
> I'd like to marshall this into xml that looks like this:
>
> <stuff>
> <names>
> <item>
> <name>Bob</name>
> </item>
> <item>
> <name>Chuck</name>
> </item>
> </names>
> </stuff>
>
> The mapping snippet for names looks like this:
>
> <field name="names" direct="true" type="java.lang.String"
> collection="arraylist">
> <bind-xml name="name" location="names/item" node="element" />
> </field>
>
> Which produces output that looks like this:
>
> <stuff>
> <names>
> <item>
> <name>Bob</name>
> <name>Chuck</name>
> </item>
> </names>
> </stuff>
>
> I'm not sure how to use the location field, or even a specific mapping
> for java.lang.String to have multiple item elements.
>
> If anyone can help with this, it would be much appreciated.
>
> Regards,
> Liehann
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email