The type attribute is for the type of object within the map and not what
type of map it is. In previous versions of castor (0.9.5.2 and earlier),
Castor only saved the elements and not the keys (unless of course the
key was part of the element). So the type always specified the type of
the value. Since 0.9.5.3 Castor saves both the key and the value...so
the type is automatically org.exolab.castor.mapping.MapItem. So you can
just remove the type. If you need to specify the type of the key and
value you can write a simple mapping for MapItem. There is an example on
the website here:

http://castor.exolab.org/xml-mapping.html#3.5-The-%3Cbind-xml%3E-element


--Keith

[EMAIL PROTECTED] wrote:
> 
> Hello,
> I'm trying to un~/marshal a HashMap.
> This is a part of the xml-file. graphic-data is the hashmap.
> ..
> - <graphic-data xsi:type="java:GUI.ImageAndPositionData"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
>   <img />
> - <pos>
>   ...
> - <graphic-data xsi:type="java:GUI.ImageAndPositionData"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
>   <img />
> - <pos>
>   ...
> I get following exception if I unmarshal it:
> ValidationException: element "graphic-data" occurs more than once.
> (XMLFieldDesciptor: graphicData AS graphic-data){file: [not available]; line:
> 2; column: 540}
> I know, I have to write a mapping file but I don't know what.
> This is what I tried but it is not correct:
> ..
> <class name="GUI.SaveData">
>                 <field name="graphic-data" collection="map"
> type="java.util.Map"/>
> </class>
> ..
> Can somebody give me an advise.
> Cheers,
> Katja
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to