=== modified file 'scour.py' --- scour.py 2011-02-11 17:29:20 +0000 +++ scour.py 2011-02-15 19:03:22 +0000 @@ -2680,7 +2680,7 @@ if preserveWhitespace: outParts.append(serializeXML(child, options, 0, preserveWhitespace)) else: - outParts.extend([os.linesep, serializeXML(child, options, indent + 1, preserveWhitespace)]) + outParts.extend(['\n', serializeXML(child, options, indent + 1, preserveWhitespace)]) onNewLine = True # text node elif child.nodeType == 3: @@ -2702,10 +2702,10 @@ if onNewLine: outParts.append(I * ind) outParts.extend(['']) - if indent > 0: outParts.append(os.linesep) + if indent > 0: outParts.append('\n') else: outParts.append('/>') - if indent > 0: outParts.append(os.linesep) + if indent > 0: outParts.append('\n') return "".join(outParts) @@ -2897,7 +2897,7 @@ # http://ronrothman.com/public/leftbraned/xml-dom-minidom-toprettyxml-and-silly-whitespace/ # rolled our own serialize function here to save on space, put id first, customize indentation, etc # out_string = doc.documentElement.toprettyxml(' ') - out_string = serializeXML(doc.documentElement, options) + os.linesep + out_string = serializeXML(doc.documentElement, options) + '\n' # now strip out empty lines lines = [] @@ -2908,7 +2908,7 @@ # return the string with its XML prolog and surrounding comments if options.strip_xml_prolog == False: - total_output = '' + os.linesep + total_output = '\n' else: total_output = "" @@ -2916,7 +2916,7 @@ if child.nodeType == 1: total_output += "".join(lines) else: # doctypes, entities, comments - total_output += child.toxml() + os.linesep + total_output += child.toxml() + '\n' return total_output @@ -3033,7 +3033,7 @@ # GZ: could sniff for gzip compression here infile = sys.stdin if options.outfilename: - outfile = maybe_gziped_file(options.outfilename, "w") + outfile = maybe_gziped_file(options.outfilename, "wb") else: outfile = sys.stdout