Why the character apostrophe is not escaped?

I was wondering why the apostrophe is not automatically escaped as other characters? For example: < is transformed to *<* and
Python : sys.version_info(major=2, minor=7, micro=6, releaselevel='final', serial=0) lxml.etree : (3, 3, 3, 0) libxml used : (2, 9, 1) libxml compiled : (2, 9, 1) libxslt used : (1, 1, 28) libxslt compiled : (1, 1, 28)

Hi,
I was wondering why the apostrophe is not automatically escaped as other characters?
Because it doesn't have to? http://www.w3.org/TR/2008/REC-xml-20081126/#syntax
For example:
< is transformed to <
"<" and "&" must be escaped
and
is transformed to >
">" may be escaped (and must be in certain contexts)
but ' is not transformed to '
"'" (and '"') may be escaped) So maybe this is libxml2's decision of how to handle things, when there's a choice. Holger Landesbank Baden-Wuerttemberg Anstalt des oeffentlichen Rechts Hauptsitze: Stuttgart, Karlsruhe, Mannheim, Mainz HRA 12704 Amtsgericht Stuttgart

2015-03-10 20:47 GMT+01:00 Omar Gutiérrez <omar.vpa@gmail.com>:
I was wondering why the apostrophe is not automatically escaped as other characters?
Because it's not needed? See https://wiki.python.org/moin/EscapingXml for a similar discussion.
-- Amaury Forgeot d'Arc

How can I escape it if I need to do it? My solution at this moment is to use tostring() to save the file and after that apply a replace, nevertheless, I think is a bad and dirty solution, because I need to add the XML's header <?xml version='1.0' encoding='UTF-8'?> with hardcoding. On Wed, Mar 11, 2015 at 2:34 AM, Amaury Forgeot d'Arc <amauryfa@gmail.com> wrote:

2015-03-11 16:28 GMT+01:00 Omar Gutiérrez <omar.vpa@gmail.com>:
How can I escape it if I need to do it?
Do you need it because the data is parsed by a non-compliant XML parser, or do you need it because the data is then embedded in another context (like a SQL sentence)?
-- Amaury Forgeot d'Arc

Hi,
I was wondering why the apostrophe is not automatically escaped as other characters?
Because it doesn't have to? http://www.w3.org/TR/2008/REC-xml-20081126/#syntax
For example:
< is transformed to <
"<" and "&" must be escaped
and
is transformed to >
">" may be escaped (and must be in certain contexts)
but ' is not transformed to '
"'" (and '"') may be escaped) So maybe this is libxml2's decision of how to handle things, when there's a choice. Holger Landesbank Baden-Wuerttemberg Anstalt des oeffentlichen Rechts Hauptsitze: Stuttgart, Karlsruhe, Mannheim, Mainz HRA 12704 Amtsgericht Stuttgart

2015-03-10 20:47 GMT+01:00 Omar Gutiérrez <omar.vpa@gmail.com>:
I was wondering why the apostrophe is not automatically escaped as other characters?
Because it's not needed? See https://wiki.python.org/moin/EscapingXml for a similar discussion.
-- Amaury Forgeot d'Arc

How can I escape it if I need to do it? My solution at this moment is to use tostring() to save the file and after that apply a replace, nevertheless, I think is a bad and dirty solution, because I need to add the XML's header <?xml version='1.0' encoding='UTF-8'?> with hardcoding. On Wed, Mar 11, 2015 at 2:34 AM, Amaury Forgeot d'Arc <amauryfa@gmail.com> wrote:

2015-03-11 16:28 GMT+01:00 Omar Gutiérrez <omar.vpa@gmail.com>:
How can I escape it if I need to do it?
Do you need it because the data is parsed by a non-compliant XML parser, or do you need it because the data is then embedded in another context (like a SQL sentence)?
-- Amaury Forgeot d'Arc
participants (3)
-
Amaury Forgeot d'Arc
-
Holger Joukl
-
Omar Gutiérrez