Kaydet (Commit) 5ded791e authored tarafından Georg Brandl's avatar Georg Brandl

Merged revisions 85546-85547 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85546 | georg.brandl | 2010-10-15 19:58:45 +0200 (Fr, 15 Okt 2010) | 1 line

  #5762: fix handling of empty namespace in minidom, which would result in AttributeError on toxml().
........
  r85547 | georg.brandl | 2010-10-15 20:00:35 +0200 (Fr, 15 Okt 2010) | 1 line

  #6098: Refrain from claiming DOM level 3 conformance in minidom.
........
üst 78f11edf
...@@ -1483,6 +1483,13 @@ class MinidomTest(unittest.TestCase): ...@@ -1483,6 +1483,13 @@ class MinidomTest(unittest.TestCase):
doc.appendChild(doc.createComment("foo--bar")) doc.appendChild(doc.createComment("foo--bar"))
self.assertRaises(ValueError, doc.toxml) self.assertRaises(ValueError, doc.toxml)
def testEmptyXMLNSValue(self):
doc = parseString("<element xmlns=''>\n"
"<foo/>\n</element>")
doc2 = parseString(doc.toxml())
self.confirm(doc2.namespaceURI == xml.dom.EMPTY_NAMESPACE)
def test_main(): def test_main():
run_unittest(MinidomTest) run_unittest(MinidomTest)
......
...@@ -291,9 +291,10 @@ def _in_document(node): ...@@ -291,9 +291,10 @@ def _in_document(node):
def _write_data(writer, data): def _write_data(writer, data):
"Writes datachars to writer." "Writes datachars to writer."
data = data.replace("&", "&amp;").replace("<", "&lt;") if data:
data = data.replace("\"", "&quot;").replace(">", "&gt;") data = data.replace("&", "&amp;").replace("<", "&lt;"). \
writer.write(data) replace("\"", "&quot;").replace(">", "&gt;")
writer.write(data)
def _get_elements_by_tagName_helper(parent, name, rc): def _get_elements_by_tagName_helper(parent, name, rc):
for node in parent.childNodes: for node in parent.childNodes:
...@@ -1340,11 +1341,9 @@ class Notation(Identified, Childless, Node): ...@@ -1340,11 +1341,9 @@ class Notation(Identified, Childless, Node):
class DOMImplementation(DOMImplementationLS): class DOMImplementation(DOMImplementationLS):
_features = [("core", "1.0"), _features = [("core", "1.0"),
("core", "2.0"), ("core", "2.0"),
("core", "3.0"),
("core", None), ("core", None),
("xml", "1.0"), ("xml", "1.0"),
("xml", "2.0"), ("xml", "2.0"),
("xml", "3.0"),
("xml", None), ("xml", None),
("ls-load", "3.0"), ("ls-load", "3.0"),
("ls-load", None), ("ls-load", None),
......
...@@ -15,6 +15,11 @@ Library ...@@ -15,6 +15,11 @@ Library
- Issue #10459: Update CJK character names to Unicode 5.2. - Issue #10459: Update CJK character names to Unicode 5.2.
- Issue #6098: Don't claim DOM level 3 conformance in minidom.
- Issue #5762: Fix AttributeError raised by ``xml.dom.minidom`` when an empty
XML namespace attribute is encountered.
- Issue #1710703: Write structures for an empty ZIP archive when a ZipFile is - Issue #1710703: Write structures for an empty ZIP archive when a ZipFile is
created in modes 'a' or 'w' and then closed without adding any files. Raise created in modes 'a' or 'w' and then closed without adding any files. Raise
BadZipfile (rather than IOError) when opening small non-ZIP files. BadZipfile (rather than IOError) when opening small non-ZIP files.
......
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