[New-bugs-announce] [issue22622] ElementTree only writes declaration when passed encoding
towb
report at bugs.python.org
Mon Oct 13 13:16:08 CEST 2014
New submission from towb:
This generates an XML declaration:
import xml.etree.ElementTree as ET
root = ET.Element('rss', version='2.0')
tree = ET.ElementTree(root)
tree.write('test.xml', encoding='iso-8859-1', xml_declaration=True)
However the declaration disappears if your don't pass an encoding. This doesn't match the documentation:
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).
----------
components: Library (Lib)
messages: 229238
nosy: towb
priority: normal
severity: normal
status: open
title: ElementTree only writes declaration when passed encoding
type: behavior
versions: Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22622>
_______________________________________
More information about the New-bugs-announce
mailing list