[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] How to get MOXy to trim the text values?
|
Hi Matt,
Sure. I created the enhancement request here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=235850
I'll try what you suggested for the workaround.
Thanks!
--Polly
Matt MacIvor wrote:
>
> Hi Polly,
>
> Currently EclipseLink MOXy considers everything inside an element to be
> significant, and therefore doesn't trim the value. You can work around
> this in a couple of ways.
>
> One would be to implement a Converter (see
> org.eclipse.persistence.mappings.converters.Converter interface) and add
> this to your mapping with a session customization. This would allow you
> to manually trim the value before it's set in your object. You could
> also do this with a custom attribute accessor. (see
> org.eclipse.persistence.mappings.AttributeAccessor).
>
> I agree there should be an easier way to do this. We should be able to
> just add a flag on XMLDirectMapping to indicate that string values
> should be trimmed.
>
> Could you enter an enhancement request to this effect?
>
> Thanks,
>
> -Matt
>
> amphoras wrote:
>
>>Hi,
>>
>>I mapped a field in my Java class to an XPath like
"ns1:CountryCode/text()".
>>
>>I find that when the XML looks like this:
>> <CountryCode listID='' listAgencyID=''
>>listAgencyName='' listName='' listVersionID='' name='' languageID=''
>>listURI='http://www.foo.com' listSchemeURI='http://www.foo.com'>
>> USA
>> </CountryCode>
>>
>>The value that gets unmarshalled is " USA".
All
>>those spaces that were used for formatting are preserved. Is there a way
to
>>configure EclipseLink to trim the spaces on either end of the string and
>>just give me "USA"?
>>
>>Thanks!
>>--Polly
>>
>>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>
>
--
View this message in context: http://www.nabble.com/How-to-get-MOXy-to-trim-the-text-values--tp17653021p17672575.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.