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

2012-06-15 Thread Ariel Poliak

Ariel Poliak  added the comment:

Ideally, this would be taken care by the _serialize_xml() with a parameter 
specified when called from within write().

However, the signature for the _serialize_xml() function cannot be changed, as 
it needs to match the signature for the rest of the _serialize_*() functions 
(since which serializing function is chosen from a dictionary that then calls 
the specific function using the same parameters.

An alternative to this would be to create a single variable within the scope of 
ElementTree at runtime if the code calls to write out the full tags closing, 
and have the _serialize_xml() function check for the presence and value of that 
variable.

I initially approached the problem via the flags on Element instead due to the 
perceived usefulness of giving the programmer full control on how the tree is 
serialized into XML.

However, if I'm the only one that sees that as useful, I can certainly refactor 
the code to go with the above solution (or some other more elegant solution).

--

___
Python tracker 
<http://bugs.python.org/issue14377>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-06-12 Thread Ariel Poliak

Ariel Poliak  added the comment:

Made a new patch.
This one contains changes for xml.etree.ElementTree for cpython, jython, and 
stackless.
It also contains changes to Modules/_elementtree.c for cpython and stackless.

The changes within this patch do not change the signature for the _serialize_* 
methods, so it can be used with any third-party library that extends 
ElementTree.

--
Added file: 
http://bugs.python.org/file25946/ElementTree-force_long_tags-v3.patch

___
Python tracker 
<http://bugs.python.org/issue14377>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-03-23 Thread Ariel Poliak

Ariel Poliak  added the comment:

To answer eli.bendersky's questions:

1. That's just the name of the file with my changes in it.
I pulled the original file from Hg, copied it to "ElementTree_new.py", made my 
changes, and created a patch from the two.

2. I'm not very familiar with the structure of the codebase for Python, so I'll 
provide some information that sounds relevant to me...

The changes I made were for the ElementTree.py file under 
cpython/Lib/xml/etree/ .
I used 
http://hg.python.org/cpython/file/54055646fd1f/Lib/xml/etree/ElementTree.py as 
the base to make a new patch, reflecting storchaka's recommendation on logic 
order and a clarification on path name for the modified file.

The source for the 'ElementC14N' module is not part of Python, so I cannot 
modify the code for the '_serialize_c14n' function.
It appears that this is dependent on http://bugs.python.org/issue13611 .

Looks like I may need to refactor this patch to work in a way that does not 
alter the signature for the _serialize_* methods.

--
Added file: 
http://bugs.python.org/file25008/ElementTree_py-force_long_tags-v2.patch

___
Python tracker 
<http://bugs.python.org/issue14377>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-03-20 Thread Ariel Poliak

New submission from Ariel Poliak :

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 "".

Whether or not the short notation is used instead of the long "" 
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 
<http://bugs.python.org/issue14377>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com