The definition of the DOM API for Python is given as part of the xml.dom module documentation. This section lists the differences between the API and xml.dom.minidom.
) |
writer[,indent=""[,addindent=""[,newl=""]]]) |
Changed in version 2.1: The optional keyword parameters indent, addindent, and newl were added to support pretty output.
Changed in version 2.3: For the Document node, an additional keyword argument encoding can be used to specify the encoding field of the XML header.
[encoding]) |
With no argument, the XML header does not specify an encoding, and the result is Unicode string if the default encoding cannot represent all characters in the document. Encoding this string in an encoding other than UTF-8 is likely incorrect, since UTF-8 is the default encoding of XML.
With an explicit encoding argument, the result is a byte string in the specified encoding. It is recommended that this argument is always specified. To avoid UnicodeError exceptions in case of unrepresentable text data, the encoding argument should be specified as "utf-8".
Changed in version 2.3: the encoding argument was introduced.
[indent[, newl]]) |
\n
.
New in version 2.1. Changed in version 2.3: the encoding argument; see toxml().
The following standard DOM methods have special considerations with xml.dom.minidom:
deep) |
See About this document... for information on suggesting changes.