Hi Jens,

The Xerces Serializers don't need patching on this...that's simply the
way XML works...there are special characters in XML, and '&' is one of
them. It indicates the start of an entity. However, when you have a
string in memory that contains "&" such as:

"if (x < y) {"

Then when you serialize this, you'll get:

if (x < y) {

That's because the serializer wants to make sure that when an XML parser
reads the characters, you'll get back:

"if (x < y) {"

in memory again.

So there is no bug. I understand what you're trying to do, but if you
really want:

if (x < y) {

as your output, then your in-memory string must look like:

"if (x < y) {"

No bugs...just the way XML parsing and serializing works.

--Keith


Jens Saade wrote:
> 
> I had a look into the Xerces sources - obviously the XMLSerializer
> exchanges *every* ampersand - regardless if its a part of an html-entity
> like &lt; or not.
> Either I'll have to patch this class or look for other serializers.
> Xerces has some HTML/XHTML Serializers aswell, maybe they will do.
> 
> BTW .. this feature has already been sent in as bug/enhancement but wont
> be fixed:
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15007
> 
> Jens Saade wrote:
> 
> >
> > Hi,
> >
> > when marshalling objects into XML castor exchanges ampersands of HTML
> > entities in CDATA, like e.g. &ouml; into &amp;ouml;
> > I'm using castor 0.9.5.2.
> >
> > Does anyone know whats causing this or how to make a workaround for that?
> >
> > cheers,
> > Jens
> >
> > ----------------------------------------------------------- If you
> > wish to unsubscribe from this mailing, send mail to
> > [EMAIL PROTECTED] with a subject of:
> >        unsubscribe castor-dev
> 
> --
> PIRONET NDH AG
> Jens Saade - Application Developer - Business Center Industry
> Maarweg 149-161, 50825 Cologne - Germany
> Phone: +49 (0)221-770-1794 - Fax: +49 (0)221-770 1005
> Mail to: [EMAIL PROTECTED] - http://www.pironet-ndh.com
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to