Bugs item #1262320, was opened at 2005-08-17 10:11
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1262320&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: XML
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: John Whitley (jwhitley)
Assigned to: Nobody/Anonymous (nobody)
Summary: minidom.py alternate newl support is broken

Initial Comment:
In minidom.py, class Document and a few other nodes
have hardcoded newlines ('\n') remaining, causing the
"newl" parameter to potentially produce a file with
mixed line endings, e.g. if newl is set to Windows line
endings ("\r\n" ).
A diff follows which fixes all instances of the problem
of which I'm aware.

*** /usr/lib/python2.4/xml/dom/minidom.py.orig  Tue Aug
16 17:38:40 2005
--- /usr/lib/python2.4/xml/dom/minidom.py.new   Tue Aug
16 17:38:40 2005
***************
*** 1286,1292 ****
              writer.write(" [")
              writer.write(self.internalSubset)
              writer.write("]")
!         writer.write(">\n")
  
  class Entity(Identified, Node):
      attributes = None
--- 1286,1292 ----
              writer.write(" [")
              writer.write(self.internalSubset)
              writer.write("]")
!         writer.write(">%s" % newl)
  
  class Entity(Identified, Node):
      attributes = None
***************
*** 1739,1747 ****
      def writexml(self, writer, indent="",
addindent="", newl="",
                   encoding = None):
          if encoding is None:
!             writer.write('<?xml version="1.0" ?>\n')
          else:
!             writer.write('<?xml version="1.0"
encoding="%s"?>\n' % encoding)
          for node in self.childNodes:
              node.writexml(writer, indent, addindent,
newl)
  
--- 1739,1747 ----
      def writexml(self, writer, indent="",
addindent="", newl="",
                   encoding = None):
          if encoding is None:
!             writer.write('<?xml version="1.0" ?>%s' %
newl)
          else:
!             writer.write('<?xml version="1.0"
encoding="%s"?>%s' % (encoding,newl))
          for node in self.childNodes:
              node.writexml(writer, indent, addindent,
newl)
  


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1262320&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to