Toby, changing the class mapping for 'myCollection' to
<class name="xml.c1175.MyCollection">
<field name="strings" collection="map">
<bind-xml name="strings">
<class name="org.exolab.castor.mapping.MapItem">
<field name="key" type="java.util.Date">
<bind-xml name="date" node="attribute" />
</field>
<field name="value" collection="arraylist"
type="java.lang.String">
<bind-xml name="string" />
</field>
</class>
</bind-xml>
</field>
</class>
did the trick. Please note that there's no <bind-to> element, but that
there's <bind-xml> elements. In other words, a typo on your side caused
a bit of havoc.
Werner
Toby wrote:
> Great stuff thanks :)
>
> 2008/5/18 Werner Guttmann <[EMAIL PROTECTED]>:
>
>> Yes, that's a valid Castor mapping file (as far as I can tell). As
>> already said, I will be having a look at this in detail.
>>
>> Werner
>>
>> Toby wrote:
>>> Hi,
>>>
>>> I attached it with a funny name on my orginal, but it looks like this...
>> (is
>>> this the file you mean?)
>>>
>>> <mapping>
>>> <class name="com.racediary.model.MyCollection">
>>> <field name="strings" collection="map">
>>> <bind-to name="strings">
>>> <class name="org.exolab.castor.mapping.MapItem">
>>> <field name="key" type="java.util.Date">
>>> <bind-xml name="date" node="attribute" />
>>> </field>
>>> <field name="value" type="java.util.List">
>>> <bind-xml name="string" />
>>> </field>
>>> </class>
>>> </bind-to>
>>> </field>
>>> </class>
>>> </mapping>
>>>
>>> Cheers
>>>
>>> 2008/5/15 Werner Guttmann <[EMAIL PROTECTED]>:
>>>
>>>> So yoo are using a mapping file ... okay, let's have a look.
>>>>
>>>> Werner
>>>>
>>>> Toby wrote:
>>>>> Hi,
>>>>>
>>>>> Thanks for the reply, yep, using a mapping file, in the attached test
>>>> case,
>>>>> I named it mycollection.xml.
>>>>>
>>>>> Cheers,
>>>>> Toby
>>>>>
>>>>> 2008/5/14 Werner Guttmann <[EMAIL PROTECTED]>:
>>>>>
>>>>>> Oops, forgot to mention that the Jira issues you mentioned all talk
>>>>>> about such scenarios where a mapping file is used. As far as I can
>> tell,
>>>>>> you are not using one, right ?
>>>>>>
>>>>>> Werner
>>>>>>
>>>>>> Toby wrote:
>>>>>>> Anyone mind if I raise an issue in Jira for this one?
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Toby
>>>>>>>
>>>>>>> 2008/5/5 Toby:
>>>>>>>
>>>>>>>> Hi Folks,
>>>>>>>>
>>>>>>>> When I try to marshal a collection (specifically a Map) that
>> contains
>>>>>>>> another collection (specifically a List), it marshals things in a
>>>>>> sensible
>>>>>>>> way, so for something like a Map<Date>, List<String>>, it'll
>> generate
>>>>>> the
>>>>>>>> following XML;
>>>>>>>>
>>>>>>>> <my-collection>
>>>>>>>> <strings>
>>>>>>>> <key xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>>>> xsi:type="date">2008-05-05T21:23:19.906+01:00</key>
>>>>>>>> <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
>> "
>>>>>>>> xsi:type="java:java.lang.String">Hello</value>
>>>>>>>> <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
>> "
>>>>>>>> xsi:type="java:java.lang.String">World!</value>
>>>>>>>> </strings>
>>>>>>>> </my-collection>
>>>>>>>>
>>>>>>>> but is unable to unmarshall them complaining that the "value" is
>>>>>> repeated.
>>>>>>>> As in,
>>>>>>>>
>>>>>>>> *org.exolab.castor.xml.MarshalException: element "value" occurs more
>>>>>> than
>>>>>>>> once. (parent class: org.exolab.castor.mapping.MapItem)
>>>>>>>> location: /strings/strings/value{File: [not available]; line: 6;
>>>>>> column:
>>>>>>>> 117}*
>>>>>>>>
>>>>>>>> This seems to be very similar to bugs 1313, 1551 etc, but although
>>>> they
>>>>>> say
>>>>>>>> its been resolved I get still get the problem on 1.2 of Castor. I
>>>> can't
>>>>>>>> quiet figure out what those bugs are telling me, or how to apply the
>>>>>> patches
>>>>>>>> or run the test case in 1313.
>>>>>>>>
>>>>>>>> I've attached a test case that demonstrates the problem.
>>>>>>>>
>>>>>>>> Any tips? Thanks in advance,
>>>>>>>> Toby
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe from this list, please visit:
>>>>>>
>>>>>> http://xircles.codehaus.org/manage_email
>>>>>>
>>>>>>
>>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe from this list, please visit:
>>>>
>>>> http://xircles.codehaus.org/manage_email
>>>>
>>>>
>>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>> http://xircles.codehaus.org/manage_email
>>
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email