commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "RODRIGUEZ Eric" <>
Subject RE: Betwixt and collections
Date Tue, 21 Mar 2006 08:21:34 GMT
Thanks for you answer.

I have no fixed structure for the xml since I generate it with betwixt.
So I will update to the latest version and test again.



ps: the error for the listname was due to a find/replace. But the main question was about
the collections ;)

-----Original Message-----
From: robert burrell donkin
Sent: mardi 21 mars 2006 0:11
To: Jakarta Commons Users List
Subject: Re: Betwixt and collections

On Mon, 2006-03-20 at 10:04 +0100, RODRIGUEZ Eric wrote: 
> Hi all,

hi eric

> I'm sorry if this may seem to you a classic (dummy) question but I get some difficulties
to get working betwixt with collections.
> Basically, my problem is with List  I got a userlist with "boys" and "girls" list, and
I want to be populated in the right way.
> I get lost in the documentation to find a example on how to handle correctly the "addDefaults"
or "updater" settings.

it's worth bearing in mind that the documentation on the website
represents the latest code. a lot of work has been put in since the last
release and i recommend updating to the latest code (build from the
repository or grab a recent nightly) if you have any problems. 

> What should I use to ensure that boys entries are added to boys List (and girls to girls
> Sorry if this may seem too simple but I tried several betwixt-config files and .betwixt
but I can't get this working properly.

if you have flexibility over your xml format then this will work without any mapping file
if you are willing to make a few changes the format.

the wrapping element for each object in the collection should match the property name. so
if you use:

> Betwixt XML out:
> <?xml version='1.0' ?>  <users>
>     <boys>
>       <boy>
>         <name>Boy 1</name>
>       </boy>
>       <boy>
>         <name>Boy 2</name>
>       </boy>
>     </boys>
>     <girls>
>       <girl>
>         <name>Girl 1</name>
>       </girl>
>       <girl>
>         <name>Girl 2</name>
>       </girl>
>     </girls>
>     <userListName>User List</userListName>
>   </users>

this works for me (using the latest code - you may need to update).

note that 'userListName' does not match the name of your bean property. the easiest way to
make this mapping work is to either change the name of your property or of the element.

if the xml format is fixed then this makes things a little more difficult and you'll need
a dot betwixt file for UserList. let me know if this is the case and i'll try to give you
some more help.

- robert

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message