Skip to content

Commit 03530b9

Browse files
Describe the default_namespace parameter of ElemetTree.write.
1 parent b09b167 commit 03530b9

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

Doc/library/xml.etree.elementtree.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -468,16 +468,18 @@ ElementTree Objects
468468
root element.
469469

470470

471-
.. method:: write(file, encoding="us-ascii", xml_declaration=None, method="xml")
471+
.. method:: write(file, encoding="us-ascii", xml_declaration=None, \
472+
default_namespace=None, method="xml")
472473

473474
Writes the element tree to a file, as XML. *file* is a file name, or a
474-
:term:`file object` opened for writing. *encoding* [1]_ is the output encoding
475-
(default is US-ASCII). Use ``encoding="unicode"`` to write a Unicode string.
476-
*xml_declaration* controls if an XML declaration
475+
:term:`file object` opened for writing. *encoding* [1]_ is the output
476+
encoding (default is US-ASCII). Use ``encoding="unicode"`` to write a
477+
Unicode string. *xml_declaration* controls if an XML declaration
477478
should be added to the file. Use False for never, True for always, None
478-
for only if not US-ASCII or UTF-8 or Unicode (default is None). *method* is
479-
either ``"xml"``, ``"html"`` or ``"text"`` (default is ``"xml"``).
480-
Returns an (optionally) encoded string.
479+
for only if not US-ASCII or UTF-8 or Unicode (default is None).
480+
*default_namespace* sets the default XML namespace (for "xmlns").
481+
*method* is either ``"xml"``, ``"html"`` or ``"text"`` (default is
482+
``"xml"``). Returns an (optionally) encoded string.
481483

482484
This is the XML file that is going to be manipulated::
483485

Lib/xml/etree/ElementTree.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,11 +802,12 @@ def iterfind(self, path, namespaces=None):
802802
# @param **options Options, given as keyword arguments.
803803
# @keyparam encoding Optional output encoding (default is US-ASCII).
804804
# Use "unicode" to return a Unicode string.
805-
# @keyparam method Optional output method ("xml", "html", "text" or
806-
# "c14n"; default is "xml").
807805
# @keyparam xml_declaration Controls if an XML declaration should
808806
# be added to the file. Use False for never, True for always,
809807
# None for only if not US-ASCII or UTF-8 or Unicode. None is default.
808+
# @keyparam default_namespace Sets the default XML namespace (for "xmlns").
809+
# @keyparam method Optional output method ("xml", "html", "text" or
810+
# "c14n"; default is "xml").
810811

811812
def write(self, file_or_filename,
812813
# keyword arguments

0 commit comments

Comments
 (0)