You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Thomas Börkel <tb...@ap-ag.com> on 2002/07/23 14:01:53 UTC

XMLSerializer: Escaping of single quotes

HI!

The XMLSerializer escapes single quotes ('). Why? If I want to transfrom the string back into a Document object, un-escaped single quotes work pretty well. Escaping <, > and & is OK, but why '?

Thanks!

Regards,
Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: XMLSerializer: Escaping of single quotes

Posted by Elena Litani <el...@ca.ibm.com>.
Hi Thomas, 

Thomas Börkel wrote:
> The XMLSerializer escapes single quotes ('). Why? If I want to transfrom the string back into a Document object, un-escaped single quotes work pretty well. Escaping <, > and & is OK, but why '?

I believe this is done to avoid the problems in HTML (which Joe refers
to). Xerces includes HTML, XHTML and XML serializers -- all inherit from
BaseMarkupSerializer that actually has code for escaping characters.
In addition XMLSerializer uses the same method for printing attribute
values and element text content (I guess this is a reason it chooses to
escape both " and ').

I agree we need to change this behavior. Do you have time to look into
serializer code and to provide a patch?

Btw, do you use DOM or SAX?

Thx,
-- 
Elena Litani / IBM Toronto

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org