Java Mailing List Archive

http://www.junlu.com/

Home » user.castor »

[castor-user] One Array List Collection Field Multiple XML Elements

Tim Milstead

2012-04-06

Replies: Find Java Web Hosting

Author LoginPost Reply
I have a single array list collection field, e.g. addressLines that I
want to unmarshall from multiple XML elements, e.g. <C_ADDRESS1>,
<C_ADDRESS2>, etc. Each XML element contains the value of a single
element in the collection.

How do I go about mapping this?

I've tried something like:

   <field name="addressLines" type="string" collection="arraylist">
     <bind-xml name="C_ADDRESS1" node="element">

     </bind-xml>
   </field>

   <field name="addressLines" type="string" collection="arraylist">
     <bind-xml name="C_ADDRESS2" node="element">

     </bind-xml>
   </field>

But I unsurprisingly get a mapping exception telling me that the
addressLines field appears more than once.

I wonder if this is even impossible with a custom field handler since
that will still be configured with only one XML element name?

Tim

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

  http://xircles.codehaus.org/manage_email


©2008 junlu.com - Jax Systems, LLC, U.S.A.