diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-27 18:37:51 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-27 18:37:51 (GMT) |
commit | 0619ae798d548109180178eda0ec406d725f7d9e (patch) | |
tree | 8d5ab27410298b928b683761f1f48e0976eed002 /Lib/xml | |
parent | 35e982f770e9898cf72ca7a434d892c3396a2734 (diff) | |
download | cpython-0619ae798d548109180178eda0ec406d725f7d9e.zip cpython-0619ae798d548109180178eda0ec406d725f7d9e.tar.gz cpython-0619ae798d548109180178eda0ec406d725f7d9e.tar.bz2 |
Merged revisions 85858 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85858 | antoine.pitrou | 2010-10-27 20:33:30 +0200 (mer., 27 oct. 2010) | 5 lines
Issue #5027: The standard `xml` namespace is now understood by
xml.sax.saxutils.XMLGenerator as being bound to
http://www.w3.org/XML/1998/namespace. Patch by Troy J. Farrell.
........
Diffstat (limited to 'Lib/xml')
-rw-r--r-- | Lib/xml/sax/saxutils.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/xml/sax/saxutils.py b/Lib/xml/sax/saxutils.py index e845015..b05e815 100644 --- a/Lib/xml/sax/saxutils.py +++ b/Lib/xml/sax/saxutils.py @@ -98,6 +98,12 @@ class XMLGenerator(handler.ContentHandler): def _qname(self, name): """Builds a qualified name from a (ns_url, localname) pair""" if name[0]: + # Per http://www.w3.org/XML/1998/namespace, The 'xml' prefix is + # bound by definition to http://www.w3.org/XML/1998/namespace. It + # does not need to be declared and will not usually be found in + # self._current_context. + if 'http://www.w3.org/XML/1998/namespace' == name[0]: + return 'xml:' + name[1] # The name is in a non-empty namespace prefix = self._current_context[name[0]] if prefix: |