It seems like you're trying to do a pretty standard thing. You should 
use a jibx <collection> element in your binding. You should have a field 
of type collection in your object. You can check the example at 
http://jibx.sourceforge.net/binding/tutorial/binding-collects.html  , 
the <collection field="notes"> binding does just what you want..

regards,

SerkanC




Keith Bennett wrote:
> Hi,
>
> I am trying to configure JiBX to allow a repeating XML element to be
> unmarshalled into a single collection on a Java object.  Currently, I
> am coming across the following exception:
>
> 11:51:25,277 ERROR [STDERR]
> org.springframework.oxm.jibx.JibxUnmarshallingFailureException: JiBX
> unmarshalling exception: Expected
> "{http://service.webservice.company.com}code"; start tag, found
> "{http://service.webservice.company.com}numberList"; start tag (line 4,
> col  10); nested exception is org.jibx.runtime.JiBXException: Expected
> "{http://service.webservice.company.com}code"; start tag, found
> "{http://service.webservice.compnay.com}numberList"; start tag (line 4,
> col 10)
>
>
> Below is the JiBX binding file as it is currently defined:
>
> <binding direction="input">
>       <namespace uri="http://service.webservice.company.com";
>               default="elements" />
>       <mapping name="retrieveItemList"
>               class="com.company.ItemServiceContract">
>               <value name="customerId" field="customerId" nillable="true" />
>               <structure allow-repeats="true" ordered="false">
>                       <value name="numberList" set-method="addNumber" 
> nillable="true"
> ordered="false" />
>               </structure>
>               <value name="code" field="code" nillable="true" />
>               <value name="year" field="year" />
>       </mapping>
> </binding>
>
> Here's the schema for the request XML:
>
> <soapenv:Envelope xmlns:q0="http://service.webservice.company.com";
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
> xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
>    <soapenv:Body>
>       <q0:retrieveItemList>
>          <q0:customerId xsi:nil="true"/>
>          <q0:numberList>5697412</q0:numberList>
>          <q0:numberList>7825272</q0:numberList>
>          <q0:code>19</q0:code>
>          <q0:year>2009</q0:year>
>       </q0:retrieveItemList>
>    </soapenv:Body>
> </soapenv:Envelope>
>
> I am using JiBX version 1.2.1.  If I include a single numberList
> element in the request, the request is processed successfully.  As
> soon as I add the second one, that's when I get the exception.  Does
> anyone know how to do what I am trying to do?  I thought that the
> allow-repeats would do the trick, but it isn't.  I haven't been able
> to figure a way to do this.  I tried using a JiBX collection, but I
> didn't know how to take the multiple repeating XML elements and
> consolidate them into a single Java collection.
>
> I appreciate your help with this.
>
> Keith
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables 
> unlimited royalty-free distribution of the report engine 
> for externally facing server and web deployment. 
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>   


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to