There is an option in jaxb marshaller to escape those white space
characters by setting its property "jaxb.encoding" to "UTF-8". If you
have a direct access to the marshaller you could just do
marshaller.setProperty("jaxb.encoding", "UTF-8")
If you use jaxws endpoint in CXF, you can achieve the same effect by
setting the jaxws endpoint's dataBidning property:
<jaxws:dataBinding> <bean
class="org.apache.cxf.jaxb.JAXBDataBinding"> <property
name="marshallerProperties"> <map> <entry
key="jaxb.encoding" value="UTF-8"/> </map> </property>
</bean> </jaxws:dataBinding>
Note that there is a peculiar behavior (a bug or an intended behavior
in jaxb lib?) that this trick only works with the upper case encoding
name "UTF-8" and not with "utf-8".
With the above setting, an attribute value of "Bill [TAB]and[CR][LF]
Marry" will be serialized as "Bill 	and
 Marry".
regards, aki
2011/12/6 mcjohnt <[email protected]>:
> In this case the xml is generated by a cxf-based service (also 2.2.10 base).
> Since we have control of the service, modifying is an option. Currently we
> assign the string with line returns as a field in a Java object, which is
> later translated to XML as part of the web service return structure.
>
> What is the preferred point/method to get control and translate the line
> feeds to 
 sequences? I don't want to enter as part of the original
> string, or the first character will be translated to '&', etc.
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Line-feeds-removed-by-client-tp5052180p5052934.html
> Sent from the cxf-user mailing list archive at Nabble.com.