diff options
author | Henry Harutyunyan <henryharutyunyan@gmail.com> | 2020-02-29 08:22:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-29 08:22:19 (GMT) |
commit | dc04a0571e362cd3de040771d7705cb107ae26fc (patch) | |
tree | 0184295482e356caa91427ae37a2541723da0b82 /Doc/library/xml.dom.minidom.rst | |
parent | 02673352b5db6ca4d3dc804965facbedfe66425d (diff) | |
download | cpython-dc04a0571e362cd3de040771d7705cb107ae26fc.zip cpython-dc04a0571e362cd3de040771d7705cb107ae26fc.tar.gz cpython-dc04a0571e362cd3de040771d7705cb107ae26fc.tar.bz2 |
bpo-37534: Allow adding Standalone Document Declaration when generating XML documents (GH-14912)
Diffstat (limited to 'Doc/library/xml.dom.minidom.rst')
-rw-r--r-- | Doc/library/xml.dom.minidom.rst | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/Doc/library/xml.dom.minidom.rst b/Doc/library/xml.dom.minidom.rst index 8711242..2c78cd9 100644 --- a/Doc/library/xml.dom.minidom.rst +++ b/Doc/library/xml.dom.minidom.rst @@ -132,7 +132,8 @@ module documentation. This section lists the differences between the API and ... # Work with dom. -.. method:: Node.writexml(writer, indent="", addindent="", newl="") +.. method:: Node.writexml(writer, indent="", addindent="", newl="", + encoding=None, standalone=None) Write XML to the writer object. The writer receives texts but not bytes as input, it should have a :meth:`write` method which matches that of the file object @@ -144,11 +145,18 @@ module documentation. This section lists the differences between the API and For the :class:`Document` node, an additional keyword argument *encoding* can be used to specify the encoding field of the XML header. + Silimarly, explicitly stating the *standalone* argument causes the + standalone document declarations to be added to the prologue of the XML + document. + If the value is set to `True`, `standalone="yes"` is added, + otherwise it is set to `"no"`. + Not stating the argument will omit the declaration from the document. + .. versionchanged:: 3.8 The :meth:`writexml` method now preserves the attribute order specified by the user. -.. method:: Node.toxml(encoding=None) +.. method:: Node.toxml(encoding=None, standalone=None) Return a string or byte string containing the XML represented by the DOM node. @@ -160,11 +168,14 @@ module documentation. This section lists the differences between the API and encoding. Encoding this string in an encoding other than UTF-8 is likely incorrect, since UTF-8 is the default encoding of XML. + The *standalone* argument behaves exactly as in :meth:`writexml`. + .. versionchanged:: 3.8 The :meth:`toxml` method now preserves the attribute order specified by the user. -.. method:: Node.toprettyxml(indent="\\t", newl="\\n", encoding=None) +.. method:: Node.toprettyxml(indent="\\t", newl="\\n", encoding=None, + standalone=None) Return a pretty-printed version of the document. *indent* specifies the indentation string and defaults to a tabulator; *newl* specifies the string @@ -173,6 +184,8 @@ module documentation. This section lists the differences between the API and The *encoding* argument behaves like the corresponding argument of :meth:`toxml`. + The *standalone* argument behaves exactly as in :meth:`writexml`. + .. versionchanged:: 3.8 The :meth:`toprettyxml` method now preserves the attribute order specified by the user. |