> Hi,
>       I have a binding that is meant to unmarshal optional elements. I'am
> getting an error while unmarshalling an optional element that is coming in
> empty.
>       I am using JIBX version 1.15.
>       I have been struggling with this issue for sometime. I would really
> appreciate any help.
> 
> My binding file
> <?xml version="1.0"?>
> <binding track-source="true" 
>          direction="input" >
>       <mapping name="person" class="jibxtest.Person" 
>              flexible="true" ordered="false">
>               <value name="name" field="name"/>
>               <structure name="residential" flexible="true"
> ordered="false" >
>                  <structure name="address" field="address"
>                             usage="optional"  ordered="false"
> flexible="true" />
>                  <value field="email" name="email" usage="optional"/>
>               </structure>
>       </mapping>
>       <mapping abstract="true" class="jibxtest.Address" flexible="true"
> ordered="false">
>               <value field="street" name="street" usage="optional" />
>               <value field="zip" name="zip" usage="optional" />
>               <value field="city" name="city" usage="optional"  />
>       </mapping>
> </binding>
> 
>      Although I have address as an optional element, I'am getting an error
> saying.
> 
>       org.jibx.runtime.JiBXException: Missing required element "(unknown
> name, position 0 in binding structure)"(line 4, col 21)
>      [java] at
> org.jibx.runtime.impl.UnmarshallingContext.throwNameException(Unmarshallin
> gContext.java:315)
>      [java] at jibxtest.Address.JiBX_binding_unmarshal_1_1(Address.java)
>      [java] at jibxtest.Person.JiBX_binding_unmarshal_1_1(Person.java)
>      [java] at jibxtest.JiBX_bindingPerson_access1.unmarshal()
>      [java] at
> org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingC
> ontext.java:2537)
>      [java] at
> org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(Unmarshalling
> Context.java:2694)
>      [java] at jibxtest.JiBXTest.main(JiBXTest.java:23)
> 
>      My input XML is
> <person>
>       <name>John</name>
>       <residential>
>       <address></address>
>       <email></email>
>       </residential>
> </person>
> 
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to