camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <>
Subject Re: JAXB marshaller & control characters
Date Sat, 09 Jan 2010 14:44:05 GMT
Hi Pavel,

I just committed your patch with some of my change.
I added a comment in the JIRA[1], please check it out.
Now we need update the wiki page and finish the FallbackTypeConverter 
marshal part.

I will keep on working them tomorrow.



Willem Jiang wrote:
> Hi Pavel,
> I have a quick look at the patch, you did a good test on your code.
> Just some minor issues,
> 1. You just check the Exchange property in JaxbDataFormat marshal(), and 
>   check the filterNonXmlChars in JaxbDataFormat unmarshal method.
>    My suggestion is let the exchange property override the configure of 
> JaxbDataFormat that is same with other Camel components do.
> 2. When unmarshaling the InputStream, you need to get the 
> CharsetEncoding from Exchange like this
>     answer = unmarshaller.unmarshal(new NonXmlFilterReader(new 
> InputStreamReader(stream, IOConvertor(getCharsetName(exchange))));
> I will apply the patch later today after I finish the parts which you 
> don't start.
> Have a nice weekend :)
> Willem
> Pavel wrote:
>> Hi - Just in case I'm attaching patch of what I have so far. Not 
>> uploading to JIRA, as patch is incomplete, yet it may correlate with 
>> what you want to do. Here are the highlights:
>> * Marshalling uses custom XmlStreamWriter, while unmarshalling relies 
>> on the same, non-xml reader. I realized that wrapping XmlStreamReader 
>> does not solve the problem, as wrapper has no power to prevent 
>> underlying reader from reading bad chars and failing therefore.
>> * Filtering has changed slightly - it replaces bad chars with space 
>> chars. This a) allows to get rid of intemediate buffer and simplify 
>> the code and b) is consistent with the way e.g. Woodstox performs 
>> similar filtering.
>> * It is exchange property or data format property that turns filtering 
>> on/off.
>> * NonXmlCharFilterer performs logging of the replacement fact in case 
>> of char[]; and more readable message in case of String.
>> What's not done:
>> * I did hook filtering to data format, but did not change converter yet.
>> * Filtering option for JAXB data format is not exposed via spring DSL 
>> yet.
>> LMK if you have a feedback.
>> Thanks,
>> Pavel

View raw message