Wagle, Shriniwas wrote:
> Using JAXB, I'm creating an XML element and setting it's value using the
> "setValue (String value)" method.
>
> The value contains a combinations of some regular text characters
> intermixed with \u000d (CR) and \u000a (LF) characters.
>
> If I specify the value, for example, as a.setValue ("abc def"),
> when I marshall the XML, it replaces the & with &. So the resultant
> output becomes "abc
def". This makes the output entirely
> different from what it ought to be.
>
> To me this clearly seems to be incorrect behavior. I would have
> expected JAXB to marshall character references as is, without changing
> the & of a character reference to &
I think you are mixing layers.
JAXB works above the XML infoset layer, and unicode character escape
like is below XML infoset layer. I think the current behavior is
the reasonable behavior.
--
Kohsuke Kawaguchi
Sun Microsystems kohsuke.kawaguchi_at_sun.com