Hi,
You should give field attribute to the structure with the relevant value(i.e
field='image' in your case).
Regards,
Venkateswarlu
On Sun, Jan 4, 2009 at 11:06 PM, mr. abanjo <mr.aba...@gmail.com> wrote:
> Hi,
> i'm newer to JIBX.
> I found a problem during unmarshaling operation of this xml:
>
> <search>
> <events>
> <event>
> <title>my title</title>
> .... (a lot of other fields)
> <image>
> <url>http://....</url>
> <width>xxx</width>
> <height>xxx</height>
> </image>
> <event>
> .....(more "event")
> </events>
> </search>
>
> My corresponding java bean are:
>
> public class EventRoot {
> private List<EventBean> events = null;
> ...
> }
>
> public class EventBean {
> private String title = null;
> private EventImage image = null;
> ...
> }
>
> public class EventImage {
> private String url = null;
> private String width = null;
> private String height = null;
> ...
> }
>
> The problem is that i don't know how to tell to JIBX to handle the sub
> structure "image".
>
> I've tried with this kind of binding:
>
> <binding>
> <mapping name="search" class="EventRoot" ordered="false" >
> <collection name="events" field="events"
> factory="EventRoot.eventsListFactory" usage="optional">
> <structure name="event" type="EventBean" ordered="false"
> flexible="true" >
> <value name="title" field="title" usage="optional" />
> <structure name="image" type="EventImage" ordered="false"
> usage="optional" >
> <value name="url" field="url" usage="optional" />
> <value name="width" field="width" usage="optional" />
> <value name="height" field="height" usage="optional" />
> </structure>
> </structure>
> </collection>
> </mapping>
> </binding>
>
> But i receive this error at compilation time:
> "References to structure object must have compatible types: EventBean
> cannot be used as EventImage;"
>
> So, how i can bind the "image" tag? A "structure" can be nested inside
> another "structure"?
>
>
>
> Thanks
> Davide
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>
------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users