I found my problem : I had to create another marshaller/unmarshaller class
for my collection of HierarchyLevelName, (since I want to unmarshall the xml
in a HierarchyLevelName object, not in a String like for fileIdentifier !!)
and to change the binding file like that :

<?xml version="1.0" encoding="UTF-8"?>
<binding forwards="false" value-style="attribute">
  <mapping class="ca.gc.nrcan.mis_nap.data.MdMetadata" name="MD_Metadata">
        <namespace uri="http://www.isotc211.org/2005/gmd"; default="elements"
prefix="gmd"/>
    <structure map-as="ca.gc.nrcan.mis_nap.data.base.BaseMdMetadata"/>
  </mapping> 
  
  <mapping class="ca.gc.nrcan.mis_nap.data.base.BaseMdMetadata"
abstract="true">
        <namespace uri="http://www.isotc211.org/2005/gmd"; default="elements"/>
    <value name="id" get-method="getId" set-method="setId" style="attribute"
usage="optional"/>
    <structure name="fileIdentifier" get-method="getFileidentifier" 
        set-method="setFileidentifier" usage="required" type="java.lang.String"
        marshaller="ca.gc.nrcan.marshalling.CharacterStringMapper" 
        unmarshaller="ca.gc.nrcan.marshalling.CharacterStringMapper"/>
    <structure name="language" get-method="getLanguage"
set-method="setLanguage" 
        usage="required" type="java.lang.String"
        marshaller="ca.gc.nrcan.marshalling.CharacterStringMapper"
unmarshaller="ca.gc.nrcan.marshalling.CharacterStringMapper"/>
    <collection field="objHierarchylevelnameSet"
create-type="java.util.HashSet"
item-type="ca.gc.nrcan.mis_nap.data.Hierarchylevelname">
        <structure name="hierarchyLevelName" 
type="ca.gc.nrcan.mis_nap.data.Hierarchylevelname"
                marshaller="ca.gc.nrcan.marshalling.HierarchyLevelNameMapper" 
                
unmarshaller="ca.gc.nrcan.marshalling.HierarchyLevelNameMapper"/>
        </collection>
  </mapping>
  
  <mapping name="hierarchyLevelName"
class="ca.gc.nrcan.mis_nap.data.Hierarchylevelname"
        post-set="postset">
        <namespace uri="http://www.isotc211.org/2005/gmd"; default="elements"
prefix="gmd"/>
    <structure
map-as="ca.gc.nrcan.mis_nap.data.base.BaseHierarchylevelname"/>
  </mapping>
  
  <mapping class="ca.gc.nrcan.mis_nap.data.base.BaseHierarchylevelname"
abstract="true">
    <namespace uri="http://www.isotc211.org/2005/gco"; default="elements"
prefix="gco"/>
    <value name="id" get-method="getId" set-method="setId" style="attribute"
usage="optional"/>
    <value name="hierarchyLevelName" get-method="getHierarchylevelname"
set-method="setHierarchylevelname" 
        usage="required" />
    <structure field="objMdMetadata"
type="ca.gc.nrcan.mis_nap.data.MdMetadata"/>
  </mapping> 
</binding>

Marie-Eve Lussier-Côté

-- 
View this message in context: 
http://www.nabble.com/ClassCastException-when-marshalling-collection-tf3914868.html#a11181998
Sent from the jibx-users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
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