[issue17372] provide pretty printer for xml.etree.ElementTree

2013-08-05 Thread Laszlo Papp

Laszlo Papp added the comment:

This has just made me switching away from xml.etree.ElementTree today, sadly.

What a pity; it would have been all kind of cool to stick to this minimal, 
otherwise working parser and builder.

--
nosy: +lpapp

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17372
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17372] provide pretty printer for xml.etree.ElementTree

2013-08-03 Thread Eli Bendersky

Eli Bendersky added the comment:

I've noticed this is a duplicate of issue #14465. Closing it - let's continue 
the discussion there, when the time comes.

--
resolution:  - duplicate
stage: needs patch - committed/rejected
status: open - closed
superseder:  - xml.etree.ElementTree: add feature to prettify XML output

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17372
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17372] provide pretty printer for xml.etree.ElementTree

2013-08-01 Thread Eli Bendersky

Eli Bendersky added the comment:

Thanks for the report (Eric) and the patch (Alex). There are currently some 
open bugs we need to handle first, so this is somewhat lower priority. I hope 
to get to it before the 3.4 release.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17372
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17372] provide pretty printer for xml.etree.ElementTree

2013-07-07 Thread Alex Henderson

Alex Henderson added the comment:

I have attached a proposed patch.

This makes some design decisions which I would like someone to review:
 a) To incorporate pretty-printing into the main write() method rather than 
adding a separate toprettyxml() method. Disadvantages: greater complexity of 
_serialize_xml(). Advantages: Reduced duplication of code, easy to add other 
pretty-printing (eg HTML) in the same way.
 b) Existing whitespace on the ends of existing text is mutated. Disadvantages: 
existing whitespace content may get changed. Advantages: Greater readability 
(which is the whole point), idempotence of pretty-printing.
 c) Not to add a trailing newline. I am undecided as to whether this is a bad 
idea or a good one, but am documenting it to ensure it gets visibility.

Of these, I think b) is the only potentially controversial one, and notably its 
behaviour differs from minidom's toprettyxml. I think it's the right thing to 
do though; and for the cases where whitespace is important, perhaps we can 
respect the xml:space attribute when pretty-printing?
http://www.w3.org/TR/xml/#sec-white-space

If these design choices are deemed suitable I'm happy to update the patch to 
support pretty-printing HTML also.

--
keywords: +patch
nosy: +alex.henderson
Added file: http://bugs.python.org/file30845/issue17372.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17372
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17372] provide pretty printer for xml.etree.ElementTree

2013-07-07 Thread Alex Henderson

Alex Henderson added the comment:

One other design decision - currently it doesn't deal with the indentation of 
comments or processing instructions: it leaves them unindented. Should they be 
indented the same as other tags?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17372
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17372] provide pretty printer for xml.etree.ElementTree

2013-07-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +eli.bendersky

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17372
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17372] provide pretty printer for xml.etree.ElementTree

2013-03-06 Thread Eric Snow

New submission from Eric Snow:

minidom already has something like this:

http://docs.python.org/3/library/xml.dom.minidom.html#xml.dom.minidom.Node.toprettyxml

This is something that appears to have almost made it in quite a while ago:

http://effbot.org/zone/element-lib.htm#prettyprint
http://svn.effbot.org/public/stuff/sandbox/elementlib/indent.py

A casual search found several similar implementations out there.  For instance:

http://infix.se/2007/02/06/gentlemen-indent-your-xml

--
components: Library (Lib), XML
messages: 183635
nosy: eric.snow
priority: low
severity: normal
stage: needs patch
status: open
title: provide pretty printer for xml.etree.ElementTree
type: enhancement
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17372
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com