homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author BreamoreBoy
Recipients BreamoreBoy, eric.araujo, janssen
Date 2010年07月26日.13:03:54
SpamBayes Score 6.705994e-05
Marked as misclassified No
Message-id <1280149437.09.0.688016084555.issue3075@psf.upfronthosting.co.za>
In-reply-to
Content
This is how toprettyxml looks in 3.1/2 which seems to meet the OP's need, I'll close in a few days time unless someone objects.
def toprettyxml(self, indent="\t", newl="\n", encoding=None):
 # indent = the indentation string to prepend, per level
 # newl = the newline string to append
 use_encoding = "utf-8" if encoding is None else encoding
 writer = codecs.getwriter(use_encoding)(io.BytesIO())
 if self.nodeType == Node.DOCUMENT_NODE:
 # Can pass encoding only to document, to put it into XML header
 self.writexml(writer, "", indent, newl, encoding)
 else:
 self.writexml(writer, "", indent, newl)
 if encoding is None:
 return writer.stream.getvalue().decode(use_encoding)
 else:
 return writer.stream.getvalue()
History
Date User Action Args
2010年07月26日 13:03:57BreamoreBoysetrecipients: + BreamoreBoy, janssen, eric.araujo
2010年07月26日 13:03:57BreamoreBoysetmessageid: <1280149437.09.0.688016084555.issue3075@psf.upfronthosting.co.za>
2010年07月26日 13:03:55BreamoreBoylinkissue3075 messages
2010年07月26日 13:03:54BreamoreBoycreate

AltStyle によって変換されたページ (->オリジナル) /