Kaydet (Commit) dad91dd1 authored tarafından Fred Drake's avatar Fred Drake

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.
üst 288cd2cb
......@@ -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):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment