This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: XMLGenerator: nice elements
Type: enhancement Stage: resolved
Components: XML Versions: Python 3.2
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, Neil Muller, eric.araujo, ggenellina, ken.ganong, loewis, panzi, r.david.murray, vhata
Priority: normal Keywords: easy, needs review, patch

Created on 2007-10-27 13:33 by panzi, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python-xml-sax-saxutils.zip panzi, 2007-10-27 13:33
xml.sax.saxutils.patch panzi, 2007-10-27 13:34
_xmlplus.sax.saxutils.patch panzi, 2007-10-27 13:35
xml.sax.saxutils.patch vhata, 2008-05-10 18:11
test.test_sax.py.patch vhata, 2008-05-10 18:12 review
short_empty_tag.patch vhata, 2008-05-10 18:37 review
xml_short_empty_elements_py3k.diff Neil Muller, 2010-07-21 14:04
Messages (16)
msg56849 - (view) Author: Mathias Panzenböck (panzi) * Date: 2007-10-27 13:33
I modified xml.sax.saxutils.XMLGenerator,
_xmlplus.sax.saxutils.XMLGenerator, and
_xmlplus.sax.saxutils.LexicalXMLGenerator so that they do no longer
produce those
ugly close tags for empty elements, but use the short version. So instead of
<empty></empty> you get just <empty/>.  :) 

I used the version of saxutils.py that is shipped with python 2.5.1.
msg56850 - (view) Author: Mathias Panzenböck (panzi) * Date: 2007-10-27 13:34
patch for xml/sax/saxutils.py
msg56851 - (view) Author: Mathias Panzenböck (panzi) * Date: 2007-10-27 13:35
patch for _xmlplus.sax.saxutils.py
msg57202 - (view) Author: Gabriel Genellina (ggenellina) Date: 2007-11-07 15:56
Some (ugly) parsers insist on <container></
container> when the element is not declared to 
be empty, so this should be optional (the 
default being generate <container/>)
msg66551 - (view) Author: Jonathan Hitchcock (vhata) Date: 2008-05-10 18:11
The attached patch makes this new feature optional, by passing the
"empty_element_tag" option to the constructor.
msg66552 - (view) Author: Jonathan Hitchcock (vhata) Date: 2008-05-10 18:12
I have also added some unit tests to test the feature with the option
turned on, and off - patch attached.
msg66556 - (view) Author: Jonathan Hitchcock (vhata) Date: 2008-05-10 18:37
Acting on a comment (with which I agree) that the "empty_elements_tag"
wasn't such an obvious name, here's a (combined) patch which uses the
name "short_empty_elements" (which was my original gut-feeling idea for
the name, before I checked the W3C standard and found that they called
them "Empty-Elements tags") instead.
msg104573 - (view) Author: Ken Ganong (ken.ganong) Date: 2010-04-29 19:28
This bug is tagged as easy and appears to already have a patch and a test posted from two years ago. What is still to be done here?
msg104574 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-04-29 19:35
I added the “needs review” keyword, to make this easy to find for reviewers, changed the version (new features don’t go in older versions; check if your patches still apply), and added MvL as nosy, since he’s listed as expert for the xml package in py3k/Misc/maintainers.rst
msg110591 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-17 18:26
I believe 3.2 is still open for new features.
msg111057 - (view) Author: Neil Muller (Neil Muller) Date: 2010-07-21 14:04
Updated version of the patch against current py3k svn (r83022) attached.

This is a combined patch, including the previous xml.sax.saxutil changes (including the 'short_empty_elements' keyword) and the new tests.
msg111070 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-21 14:35
The patch looks clean to me, applied small edits to change it from git to svn.  Changed test_sax got 7 errors on run.  Changed saxutils 53 tests all passed.  Can this please be committed.
msg112979 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-08-05 14:04
Can a committer look at this please.
msg115680 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-09-06 01:06
Patch looks good to me.
msg118861 - (view) Author: Neil Muller (Neil Muller) Date: 2010-10-16 09:34
So what still needs to happen to get this in? 

Patch still applies to current python 3.2 trunk (r85564).
msg118988 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-10-17 22:48
Committed Neil's patch (after adding docs) in r85671.  Thanks.
History
Date User Action Args
2022-04-11 14:56:27adminsetgithub: 45684
2010-10-17 22:48:55r.david.murraysetstatus: open -> closed

nosy: + r.david.murray
messages: + msg118988

resolution: accepted
stage: patch review -> resolved
2010-10-16 09:34:36Neil Mullersetmessages: + msg118861
2010-09-06 01:06:27eric.araujosetmessages: + msg115680
2010-08-05 14:04:13BreamoreBoysetmessages: + msg112979
stage: commit review -> patch review
2010-07-21 14:35:38BreamoreBoysetmessages: + msg111070
stage: patch review -> commit review
2010-07-21 14:05:02Neil Mullersetfiles: + xml_short_empty_elements_py3k.diff
nosy: + Neil Muller
messages: + msg111057

2010-07-17 18:26:30BreamoreBoysetnosy: + BreamoreBoy

messages: + msg110591
versions: + Python 3.2, - Python 3.3
2010-04-29 19:35:22eric.araujosetversions: + Python 3.3, - Python 2.5
nosy: + eric.araujo, loewis

messages: + msg104574

keywords: + needs review
stage: patch review
2010-04-29 19:28:52ken.ganongsetnosy: + ken.ganong
messages: + msg104573
2008-05-10 18:37:25vhatasetfiles: + short_empty_tag.patch
messages: + msg66556
2008-05-10 18:12:35vhatasetfiles: + test.test_sax.py.patch
messages: + msg66552
2008-05-10 18:11:49vhatasetfiles: + xml.sax.saxutils.patch
nosy: + vhata
messages: + msg66551
2008-01-20 20:34:44christian.heimessetpriority: normal
keywords: + patch, easy
2007-11-07 15:56:55ggenellinasetnosy: + ggenellina
messages: + msg57202
2007-10-27 13:35:29panzisetfiles: + _xmlplus.sax.saxutils.patch
messages: + msg56851
2007-10-27 13:34:58panzisetfiles: + xml.sax.saxutils.patch
messages: + msg56850
2007-10-27 13:33:55panzicreate