Which is what I should have suggested as a work-around anyhow.

Can yo still raise a new Jira issue at
http://jira.codehaus.org/browse/CASTOR for this.

Regards
Werner

Mihir Mathuria wrote:
> 
> Yes. You are right. Looks like this is an issue with mutivalued fields
> used with location attribute.
> 
> So, I was able to make things work by declaring a dedicated class for
> each element type node. That is, in the above example, declaring a class
> Category for the <category> element.
> 
> So the earlier XML changed to:
> 
> 
> ---snippet---
> <field name="categories" collection="arraylist" type="mypackage.Category">
>     <bind-xml name="category" location="categories"/>
> </field>
> 
> <class name="mypackage.Category">
>   <field name="label" type="string">
>       <bind-xml name="label" node="attribute"/>
>   </field>
> </class>
> ----snippet---
> 
> --Mihir
> 
> 
> On Jun 3, 2009, at 11:36 PM, Werner Guttmann wrote:
> 
>> Hi,
>>
>> I am not actually convinced that this is an issue related to whitespace
>> handling at all. I think that this is an issue in the context of
>> multi-valued fields when used together with locations.
>>
>> Anyhow, to be able to look into this, can I please ask you create a new
>> Jira issue at
>>
>> http://jira.codehaus.org/browse/CASTOR
>>
>> and attach a (minimal) working test case.
>>
>> Regards
>> Werner
>>
>> Mihir Mathuria wrote:
>>>
>>> Hello Gurus,
>>>
>>> Need your help regarding unmarshalling and whitespaces.
>>>
>>> I spent quite some time on this issue and tried following advices in
>>> earlier posts, but in vain.
>>>
>>> I have the following xml:
>>>
>>> <categories>
>>>    <category label='Male Female'/>
>>>    <category label='Sports'/>
>>> </categories>
>>>
>>>
>>> I try to unmarshal that using the following mappings:
>>>
>>> <field name="columnHeaders" collection="arraylist" type="string">
>>>    <bind-xml name="label" location="categories/category"
>>> node="attribute"/>
>>> </field>
>>>
>>> However the columnHeaders arrayList comes up with 3 elements ['Male',
>>> 'Female', 'Sports'] instead of just two ['Male Female','Sports']
>>>
>>>
>>> After the creating the Unmarshaller I do make sure  preserveWhitespace
>>> is set to 'true'
>>>    unmarshaller = context.createUnmarshaller();
>>>    unmarshaller.setWhitespacePreserve(true);
>>>
>>> But this does not help.
>>>
>>> I also tried adding "xml:space='preserve'" in the <category> node above.
>>> No luck.
>>>
>>> I am running out of ideas. Some one please guide.
>>>
>>> I am using castor 1.3
>>>
>>> Thanks.
>>> Mihir.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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


Reply via email to