[docs] [issue13823] xml.etree.ElementTree.ElementTree.write - argument checking
report at bugs.python.org
Thu Jan 19 09:51:47 CET 2012
New submission from patrick vrijlandt <patrick.vrijlandt at gmail.com>:
(1) The docs say:
xml_declaration controls if an XML declaration should be added to the file. Use False for never, True for always, None for only if not US-ASCII or UTF-8 or Unicode (default is None).
The method also accepts other values, like xml_declaration = "yes". This behavior should be documented, or raise a ValueError (up to effbot, I think)
(2) The docs say (in a note):
The encoding string included in XML output should conform to the appropriate standards. For example, “UTF-8” is valid, but “UTF8” is not. See http://www.w3.org/
But the method accepts both values, (“UTF-8” and “UTF8”). Since this will result in invalid xml, (but not invalid python) it should probably raise ValueError too.
(3) Open issue 9458 also refers to this method. It might be wise to raise ValueError if the encoding does not match the (mode of the) file target (binary or text).
assignee: docs at python
components: Documentation, XML
nosy: docs at python, patrick.vrijlandt
title: xml.etree.ElementTree.ElementTree.write - argument checking
versions: Python 3.2
Python tracker <report at bugs.python.org>
More information about the docs