Worked like a charm! Thanks Keith

-----Original Message-----
From: Keith Visco [mailto:[EMAIL PROTECTED]
Sent: Monday, February 07, 2005 3:56 PM
To: [email protected]
Subject: Re: [castor-user] XML - How to wrap collection elements?




Hi Alan,

map-to will work if you make sure your collection is not treated as a 
container, by default all collections are treated as containers.

Try the following:

<field name="items" type="com.acme.Item" collection="arraylist"
    container="false">
</field>

--Keith

Alan Talanoa wrote:
> Currently, Ive only managed to create xml docs like this: 
> 
> <order> 
> <cost>12.23</cost> 
> <item> 
> foo 
> </item> 
> <item> 
> bar 
> </item> 
> </order> 
> 
> I need to be able generate: 
> 
> <order> 
> <cost>12.23</cost> 
> <ITEMS> 
> <item> 
> foo 
> </item> 
> <item> 
> bar 
> </item> 
> </ITEMS> 
> </order> 
> 
> Reading through documentation, map-to only works for the root element, but I 
> need to be able to define a "wrapping" element for when I am using a 
> collection to generate XML. I've read a bit about "containers" but dont think 
> thats what I need?
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ----------------------------------------------------------- 
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-user



----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-user

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-user

Reply via email to