--- Paul Sandoz <Paul.Sandoz_at_Sun.COM> wrote:
> Hi Arul,
>
> Unfortunately this is a restriction in default JAXB
> marshaling, which
> Jersey uses [1].
>
> To support this you will need to do your own
> marshalling using say the
> Apache XMLSerializer [2]. But in this case it is
It is also possible to tweak JAXB serialization a bit
by defining underlying xml library used for
serialization. Calls being made by JAXB can not be
changed, but how events are serialized can be changed.
For example, specifying, say, Woodstox XMLStreamWriter
as the output destination allows changing escaping
aspects.
In this particular case, it would be possible to write
an XMLStreamWriter delegate which mostly just calls
actual stream writer as-is, but changes calls to
writeCharacters() to writeCData().
I agree in that doing this should not be necessary
(CDATA and CHARACTERS are semantically equivalent),
but there is so much bad legacy code around that
sometimes it is needed.
-+ Tatu +-