| 79 | writer.write("/>%s"%(newl)) |
| 80 | |
| 81 | def _toprettyxml_node(self, indent="\t", newl="\n", encoding = None): |
| 82 | _collapse(self) |
| 83 | # indent = the indentation string to prepend, per level |
| 84 | # newl = the newline string to append |
| 85 | writer = minidom._get_StringIO() |
| 86 | if encoding is not None: |
| 87 | import codecs |
| 88 | # Can't use codecs.getwriter to preserve 2.0 compatibility |
| 89 | writer = codecs.lookup(encoding)[3](writer) |
| 90 | if self.nodeType == Node.DOCUMENT_NODE: |
| 91 | # Can pass encoding only to document, to put it into XML header |
| 92 | self.writexml(writer, "", indent, newl, encoding) |
| 93 | else: |
| 94 | self.writexml(writer, "", indent, newl) |
| 95 | return writer.getvalue() |
| 96 | |
| 97 | _patch_minidom() |