diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-02-09 17:25:47 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-02-09 17:25:47 (GMT) |
commit | 99f69ee7a1cf4d032d420ad69d22bd44b8cf6cc8 (patch) | |
tree | db02a09b57b68dbc4fa0a2162535135fd99ed20a /Lib/xml | |
parent | c77dd32be4557ad5d2e5c9a710ebeaf52d5092d1 (diff) | |
download | cpython-99f69ee7a1cf4d032d420ad69d22bd44b8cf6cc8.zip cpython-99f69ee7a1cf4d032d420ad69d22bd44b8cf6cc8.tar.gz cpython-99f69ee7a1cf4d032d420ad69d22bd44b8cf6cc8.tar.bz2 |
Merged revisions 78125 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78125 | antoine.pitrou | 2010-02-09 18:08:05 +0100 (mar., 09 févr. 2010) | 7 lines
Issue #2746: Don't escape ampersands and angle brackets ("&", "<", ">")
in XML processing instructions and comments. These raw characters are
allowed by the XML specification, and are necessary when outputting e.g.
PHP code in a processing instruction. Patch by Neil Muller.
........
Diffstat (limited to 'Lib/xml')
-rw-r--r-- | Lib/xml/etree/ElementTree.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py index c47573e..2663b33 100644 --- a/Lib/xml/etree/ElementTree.py +++ b/Lib/xml/etree/ElementTree.py @@ -662,9 +662,9 @@ class ElementTree: # write XML to file tag = node.tag if tag is Comment: - file.write(b"<!-- " + _encode_cdata(node.text, encoding) + b" -->") + file.write(_encode("<!-- %s -->" % node.text, encoding)) elif tag is ProcessingInstruction: - file.write(b"<?" + _encode_cdata(node.text, encoding) + b"?>") + file.write(_encode("<?%s?>" % node.text, encoding)) else: items = list(node.items()) xmlns_items = [] # new namespaces in this scope |