Hi,
 
I'm new to JiBX and I'm having problems binding a list of list of
objects. Here is what I got:
 
java.util.ArrayList polygon
 
where polygon contains ArrayList objects which contains Points objects.
 
I tried the following bindings:

1)
<mapping name="polygon"
class="com.webraska.vulcan.pack.search.geometry.Polygon">
  <collection name="boundaries" field="boundaries">
    <structure name="boundary">
      <collection
item-type="com.webraska.vulcan.pack.search.geometry.Point"/>
    </structure>
  </collection>
</mapping>

Points is also defined in the bindings:
<mapping name="point"
class="com.webraska.vulcan.pack.search.geometry.Point">
  <value name="id" get-method="getId" set-method="setId"/>
  <value name="longitude" get-method="getLongitude"
set-method="setLongitude"/>
  <value name="latitude" get-method="getLatitude"
set-method="setLatitude"/>
</mapping>

Here I have a compilation error :
[jibx] org.jibx.runtime.JiBXException: Unknown collection type with no
add or store method defined at tag "collection".
The tag collection the compiler talks about is the second one.

2)
I also tried this binding, since JiBX knows the binding of an ArrayList.
It was my assumption that in boudaries, JiBX found an ArrayList -> he
knows the binfind. Then inside each arrayList he finds an object he
knows the binding of (Points) so it was OK.
<mapping name="polygon"
class="com.webraska.vulcan.pack.search.geometry.Polygon">
  <collection field="boundaries" item-type="java.util.ArrayList"/>
</mapping>

But I have this error at run time:

org.jibx.runtime.JiBXException: Collection item of type
java.util.ArrayList has no binding defined
        at JiBX_MungeAdapter.JiBX_etc__marshal_1_1()
        at
com.webraska.vulcan.pack.search.geometry.Polygon.JiBX_etc__marshal_1_0(P
olygon.java)
        ...

3)
Also tried this one:
<collection name="boundaries" field="boundaries"
item-type="java.util.ArrayList">
  <structure name="boundary">
    <collection
item-type="com.webraska.vulcan.pack.search.geometry.Point"/>
  </structure>
</collection>

But I have a compilation error telling me that JiBX is expecting the
collection tag to end immediately if it contains the attribute
'item-type'

If someone knows how to deals with nested lists it will help me a lot.
Thanks

Gilles


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_idP47&alloc_id808&op=click
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to