out.normal 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. --- a/Lib/test/test_minidom.py Fri Sep 30 08:46:25 2011 +0300
  2. +++ b/Lib/test/test_minidom.py Sat Oct 01 21:02:49 2011 +0300
  3. @@ -467,6 +467,13 @@
  4.  dom.unlink()
  5.  self.confirm(domstr == str.replace("\n", "\r\n"))
  6. +
  7. + def testPrettyTextNode(self):
  8. + str = '<A>B</A>'
  9. + dom = parseString(str)
  10. + dom2 = parseString(dom.toprettyxml())
  11. + self.confirm(dom.childNodes[0].childNodes[0].toxml()==
  12. + dom2.childNodes[0].childNodes[0].toxml())
  13. 
  14.  def testProcessingInstruction(self):
  15.  dom = parseString('<e><?mypi \t\n data \t\n ?></e>')
  16.  pi = dom.documentElement.firstChild
  17. --- a/Lib/xml/dom/minidom.py Fri Sep 30 08:46:25 2011 +0300
  18. +++ b/Lib/xml/dom/minidom.py Sat Oct 01 21:02:49 2011 +0300
  19. @@ -836,7 +836,9 @@
  20.  _write_data(writer, attrs[a_name].value)
  21.  writer.write("\"")
  22.  if self.childNodes:
  23. - writer.write(">%s"%(newl))
  24. + writer.write(">")
  25. + if self.childNodes[0].nodeType != Node.TEXT_NODE: # Strict check
  26. + writer.write(newl)
  27.  for node in self.childNodes:
  28.  node.writexml(writer,indent+addindent,addindent,newl)
  29.  writer.write("%s</%s>%s" % (indent,self.tagName,newl))
  30. @@ -1061,7 +1063,7 @@
  31.  return newText
  32. 
  33.  def writexml(self, writer, indent="", addindent="", newl=""):
  34. - _write_data(writer, "%s%s%s"%(indent, self.data, newl))
  35. + _write_data(writer, self.data)
  36. 
  37.  # DOM Level 3 (WD 9 April 2002)
  38. 
  39.