[New-bugs-announce] [issue14377] Modify serializer for xml.etree.ElementTree to allow forcing the use of long tag closing

Ariel Poliak report at bugs.python.org
Wed Mar 21 05:46:26 CET 2012


New submission from Ariel Poliak <apoliak at gmail.com>:

As it stands in Hg, when the write() method of an xml.etree.ElementTree object is called, and a tag within the XML tree has no child tags or defined text, the tag is written using the short notation "<tag ... />".

Whether or not the short notation is used instead of the long "<tag ...></tag>" notation is used should be configurable by the programmer, without having to resort to serializing the XML into a string and then doing replace() on said string.

The attached patch adds an optional parameter to the write() method that provides this choice.
If the 'use_long_xml_tags' parameter is not set (or otherwise evaluates to the boolean False), the current behavior applies.
If this parameter evaluates to the boolean True, long tags are used when producing XML output.

----------
components: Library (Lib)
files: ElementTree_py-force_long_tags.patch
keywords: patch
messages: 156472
nosy: adpoliak
priority: normal
severity: normal
status: open
title: Modify serializer for xml.etree.ElementTree to allow forcing the use of long tag closing
type: enhancement
versions: Python 3.2
Added file: http://bugs.python.org/file24978/ElementTree_py-force_long_tags.patch

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


More information about the New-bugs-announce mailing list