users@jaxb.java.net

Escape special chars in marshaling.

From: <Jagdeep_Singh_at_capgroup.com>
Date: Thu, 17 Mar 2005 13:16:57 -0800

Hi All,

I am using JAXB 1.0.2. It seems during marshaling special characters are
converted to underline os specific chars. Look at my schema declaration
point-(1) below and original XML doc point-(2) below. This xml doc contains
"&#8217" to represent "'" during content rendering on web page.
Point-(3) shows the piece of code after JAXB marshal the XML doc.

Now My question is how can I preserve this special character in JAXB.

(1) XML Schema :
<xsd:element name="description" type="xsd:string" minOccurs="0"
maxOccurs="1" />

(2) XML document :
<description><![CDATA[Check out these tips to prepare your clients&#8217;
2004 U.S. tax returns, and get hints on downloading tax information into
TurboTax and making IRA contributions online.]]></description>

(3) After JAXB marshal to xml file.
I am using Apache Xerces-j 2.6.2 XMLSerializer and OutputFormat class to
produce CDATA blocks.
<description><![CDATA[Check out these tips to prepare your clientsÂ’ 2004
U.S. tax returns, and get hints on downloading tax information into
TurboTax and making IRA contributions online.]]></description>

I appreciate any help / suggestions for this problem.

- Jagdeep Singh