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

Reply via email to