summaryrefslogtreecommitdiff
path: root/Lib/xml/sax
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-08-07 19:14:46 +0000
committerFred Drake <fdrake@acm.org>2001-08-07 19:14:46 +0000
commitdad91dd1e90222cfae4543eb290e2b2fa99192c2 (patch)
tree9982a888d19d88a0b6ce6bd7bec00b29d50e3e68 /Lib/xml/sax
parent288cd2cb69dc61d3fe1b18564d62ddb280a6568a (diff)
downloadcpython-git-dad91dd1e90222cfae4543eb290e2b2fa99192c2.tar.gz
Make sure XMLGenerator uses quoteattr() instead of escape() to quote
attribute values. Just using escape() can (and always has) led to broken XML being generated. This makes sure it always produces the right thing. This actually closes SF bug #440351.
Diffstat (limited to 'Lib/xml/sax')
-rw-r--r--Lib/xml/sax/saxutils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/xml/sax/saxutils.py b/Lib/xml/sax/saxutils.py
index bf1f5f317e..8a96be60e8 100644
--- a/Lib/xml/sax/saxutils.py
+++ b/Lib/xml/sax/saxutils.py
@@ -80,7 +80,7 @@ class XMLGenerator(handler.ContentHandler):
def startElement(self, name, attrs):
self._out.write('<' + name)
for (name, value) in attrs.items():
- self._out.write(' %s="%s"' % (name, escape(value)))
+ self._out.write(' %s=%s' % (name, quoteattr(value)))
self._out.write('>')
def endElement(self, name):
@@ -101,7 +101,7 @@ class XMLGenerator(handler.ContentHandler):
for (name, value) in attrs.items():
name = self._current_context[name[0]] + ":" + name[1]
- self._out.write(' %s="%s"' % (name, escape(value)))
+ self._out.write(' %s=%s' % (name, quoteattr(value)))
self._out.write('>')
def endElementNS(self, name, qname):