summaryrefslogtreecommitdiffstats
path: root/Doc/lib/xmldomminidom.tex
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2002-06-30 15:05:00 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2002-06-30 15:05:00 (GMT)
commit7d650ca83bfdc42e852a4a6af00b80d230ecc54a (patch)
tree3f421d109018e27740476facebbc2fef2e129907 /Doc/lib/xmldomminidom.tex
parent2ebfd09e5818b7c6d555bcb297ecbb7cf863fe2c (diff)
downloadcpython-7d650ca83bfdc42e852a4a6af00b80d230ecc54a.zip
cpython-7d650ca83bfdc42e852a4a6af00b80d230ecc54a.tar.gz
cpython-7d650ca83bfdc42e852a4a6af00b80d230ecc54a.tar.bz2
Implement the encoding argument for toxml and toprettyxml.
Document toprettyxml.
Diffstat (limited to 'Doc/lib/xmldomminidom.tex')
-rw-r--r--Doc/lib/xmldomminidom.tex37
1 files changed, 36 insertions, 1 deletions
diff --git a/Doc/lib/xmldomminidom.tex b/Doc/lib/xmldomminidom.tex
index d743c7d..0d5bfea 100644
--- a/Doc/lib/xmldomminidom.tex
+++ b/Doc/lib/xmldomminidom.tex
@@ -121,10 +121,45 @@ children of that node.
Write XML to the writer object. The writer should have a
\method{write()} method which matches that of the file object
interface.
+
+\versionadded[To support pretty output, new keyword parameters indent,
+addindent, and newl have been added]{2.1}
+
+\versionadded[For the \class{Document} node, an additional keyword
+argument encoding can be used to specify the encoding field of the XML
+header]{2.3}
+
\end{methoddesc}
-\begin{methoddesc}{toxml}{}
+\begin{methoddesc}{toxml}{\optional{encoding}}
Return the XML that the DOM represents as a string.
+
+\versionadded[the \var{encoding} argument]{2.3}
+
+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 \var{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".
+
+\end{methoddesc}
+
+\begin{methoddesc}{toprettyxml}{\optional{indent\optional{, newl}}}
+
+Return a pretty-printed version of the document. \var{indent} specifies
+the indentation string and defaults to a tabulator; \var{newl} specifies
+the string emitted at the end of each line and defaults to \\n.
+
+\versionadded{2.1}
+
+\versionadded[the encoding argument; see \method{toxml}]{2.3}
+
\end{methoddesc}
The following standard DOM methods have special considerations with