Hi Stephane, The tutorial section on collections gives some examples that should be relevant: http://jibx.sourceforge.net/tutorial/binding-collects.html For what you want, a simple binding like:
<collection field="list" name="list"> <structure name="item" type="MyItem"> <value name="field" field="field"/> </structure> </collection> should do exactly what you want. Had you looked at the binding tutorial? If this isn't clear from the tutorial, I'd appreciate feedback on how to show it more clearly. - Dennis Dennis M. Sosnoski SOA, Web Services, and XML Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-296-6194 - Wellington, NZ +64-4-298-6117 Stephane Elie wrote: > Hi, > > I haven't found a way to map an array directly in the XML file. > > I would like to do something like this: > > <binding> > <!-- this works and map a single object in the XML file --> > <mapping class=" test.MyClass" name="item"> > <value name="field" field="field" /> > </mapping> > > <!-- I want to do something like this, but it doesn't work... --> > <collection item-type="test.MyClass" name="list"/> > </binding> > > I want my XML file to look like : > <list> <!-- I don't care about the name here --> > <item> > <field>value1</field> > </item> > <item> > <field>value2</field> > </item> > <item> > <field>value3</field> > </item> > </list> > > and this maps in a Java array : test.MyClass[] > > Anybody knows if this is possible? > > Thanks, > > Stephane > > P.S. > I can create a wrapper class around the array like this (but it is not > practical for me...): > <binding> > <mapping class="test.WrapperClass" name="top_level"> > <collection name="list" field="list"/> > </mapping> > </binding> > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > ------------------------------------------------------------------------ > > _______________________________________________ > jibx-users mailing list > jibx-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jibx-users > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users