Hi Rick,

The problem here is that without a wrapper element or an item-type for 
the collection there's no way for JiBX to tell when it's reached the end 
of what you intended to go into the collection. It really should give an 
error on the binding in this case. If you use item-type="..." to specify 
what goes into the collection this should work the way you want.

  - Dennis

Dennis M. Sosnoski
SOA and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117



Rick Laird wrote:
> I get an unmarshalling error when I have a mapping in which a <VALUE>
> element comes after a <COLLECTION> element.
>
> This mapping does not work.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE binding SYSTEM "C:\java\jibx\docs\binding.dtd">
> <binding>
>       <mapping name="WorkLocation"
>       
> class="com.ibaset.solumina.sffnd.worklocation.WorkLocation"
>               extends="com.ibaset.solumina.domain.ObsoletableObject" >
>
>               <value name="workLocation" field="workLocation"></value>
>               <value name="locationTitle"
> field="locationTitle"></value>
>               <value name="obsoleteRecordFlag"
> get-method="getObsoleteRecordFlag" set-method="setObsoleteRecordFlag"/>
>               <value name="repairStation" field="repairStation" />
>               <value name="updateUserId" field="updateUserId" />
>               <value name="updateTimestamp" field="updateTimestamp" />
>               <collection field="workDepartments"
> type="java.util.ArrayList" />
>               <value name="ucfWorkLocVch1" field="ucfWorkLocVch1" />
>       </mapping>
> </binding>
>
> The error is 
> org.jibx.runtime.JiBXException: No unmarshaller for element
> "ucfWorkLocVch1" (line 1, col 791)
>       at
> org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(Unmarshallin
> gContext.java:2535)
>       at
> com.ibaset.solumina.domain.JiBX_MungeAdapter.JiBX_MasterBinding_unmarsha
> l_1_0()
>       at
> com.ibaset.solumina.sffnd.worklocation.WorkLocation.JiBX_MasterBinding_u
> nmarshal_3_1(WorkLocation.java)
>       at
> com.ibaset.solumina.sffnd.worklocation.JiBX_MasterBindingWorkLocation_ac
> cess.unmarshal()
>       at
> org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(Unmarshallin
> gContext.java:2538)
>       at
> org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(Unmarshalli
> ngContext.java:2681)
>       at ObjectToXml.main(ObjectToXml.java:113)
>
> But by moving the line <value name="ucfWorkLocVch1"
> field="ucfWorkLocVch1" /> above the collection I no longer get the
> error.  Is this a constraint of JiBX?
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE binding SYSTEM "C:\java\jibx\docs\binding.dtd">
> <binding>
>       <mapping name="WorkLocation"
>       
> class="com.ibaset.solumina.sffnd.worklocation.WorkLocation"
>               extends="com.ibaset.solumina.domain.ObsoletableObject" >
>
>               <value name="workLocation" field="workLocation"></value>
>               <value name="locationTitle"
> field="locationTitle"></value>
>               <value name="obsoleteRecordFlag"
> get-method="getObsoleteRecordFlag" set-method="setObsoleteRecordFlag"/>
>               <value name="repairStation" field="repairStation" />
>               <value name="updateUserId" field="updateUserId" />
>               <value name="updateTimestamp" field="updateTimestamp" />
>             <value name="ucfWorkLocVch1" field="ucfWorkLocVch1" />
>               <collection field="workDepartments"
> type="java.util.ArrayList" />         
>       </mapping>
> </binding>
>
> Rick Laird
>
>
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier.
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> jibx-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>   

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to