You can use a List (or any subclass) directly. The binding file would
be something like:
<mapping name="People" class="com.mystuff.People>
<collection name="Person" field="peopleLst"
factory="org.jibx.runtime.Utility.arrayListFactory">
<structure name="person" type="com.mystuff.Person>
<value style="attribute" name="first" field="first"/>
<value style="attribute" name="last" field="last"/>
</structure>
</collection>
</mapping>
It assume that in People, you have a peopleLst attribute that contains
the list of "Person" class.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chris
Sent: Monday, April 16, 2007 4:26 PM
To: [email protected]
Subject: [jibx-users] Mapping question
I have the following XML:
<people>
<person first="john" last="doe"/>
<person first="jane" last="doe"/>
</people>
I have a Person class, and I would like to map this XML to a Collection
of People instances. Is this possible?
My quick and easy solution was to create a PeopleList class that had one
member of type List and mapped <people> to PeopleList. The PeopleList
class serves no other purpose other than to allow for JiBX mapping and I
was hoping I could do without it.
Thanks,
Chris
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
------------------------------------------------------------------------
-
This SF.net email is sponsored by DB2 Express Download DB2 Express C -
the FREE version of DB2 express and take control of your XML. No limits.
Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users