[New-bugs-announce] [issue23847] Add xml pretty print option to ElementTree

Raymond Hettinger report at bugs.python.org
Thu Apr 2 09:01:50 CEST 2015


New submission from Raymond Hettinger:

The xml.dom.minidom package has as a xml.toprettyxml() function that has the problem of altering the whitespace of the text of elements.   The ElementTree module needs a prettify option that works better, perhaps something based of Effbot's code at:

http://effbot.org/zone/element-lib.htm#prettyprint

The lxml package also provides an API for this purpose:

    print(etree.tostring(root, pretty_print=True))

----------
messages: 239879
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Add xml pretty print option to ElementTree
type: enhancement
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23847>
_______________________________________


More information about the New-bugs-announce mailing list