Assuming that you've got an 'outer' Java class that has the following member definition:

private List persons;

and that a getter and setter method are available for this class property, the following field mapping will do the trick:

<field name="persons" type="some.package.Person" collection="arraylist">
   <bind-xml name="persons" />
</field>

In general, have a look at ...

http://www.castor.org/xml-mapping.html

for more information about Castor XML's mapping file.

Regards
Werner

Chopped Head wrote:
Hello. I'm new to Castor and I would like to know if it's possible to map the
same class many times to the same xml file.

For example I would like to map class in order to have something like that:

<person>
   <name>Mark</name>
   <surname>Smith</surname>
</person>
<person>
   <name>John</name>
   <surname>Wilson</surname>
</person>
<person>
   ...
</person>
<person>
   ...
</person>

And more, I would like to get this back as array (Person[]) or some
collection (List<Person>). I suspect that correctly builded mapping.xml will
do the trick. Is it possible? Can you give me some suggestions or solution?

Thanks.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to