MCPcopy Index your code
hub / github.com/python/cpython / toprettyxml

Method toprettyxml

Lib/xml/dom/minidom.py:49–66  ·  view source on GitHub ↗
(self, indent="\t", newl="\n", encoding=None,
                    standalone=None)

Source from the content-addressed store, hash-verified

47 return self.toprettyxml("", "", encoding, standalone)
48
49 def toprettyxml(self, indent="\t", newl="\n", encoding=None,
50 standalone=None):
51 if encoding is None:
52 writer = io.StringIO()
53 else:
54 writer = io.TextIOWrapper(io.BytesIO(),
55 encoding=encoding,
56 errors="xmlcharrefreplace",
57 newline='\n')
58 if self.nodeType == Node.DOCUMENT_NODE:
59 # Can pass encoding only to document, to put it into XML header
60 self.writexml(writer, "", indent, newl, encoding, standalone)
61 else:
62 self.writexml(writer, "", indent, newl)
63 if encoding is None:
64 return writer.getvalue()
65 else:
66 return writer.detach().getvalue()
67
68 def hasChildNodes(self):
69 return bool(self.childNodes)

Calls 3

detachMethod · 0.95
writexmlMethod · 0.45
getvalueMethod · 0.45