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: elementtree serialization bug for weird namespace urls
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder: Update ElementTree with upstream changes
View: 6472
Assigned To: effbot Nosy List: amaury.forgeotdarc, effbot, flox, xrotwang
Priority: normal Keywords: easy, patch

Created on 2008-06-20 15:16 by xrotwang, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
etree.patch amaury.forgeotdarc, 2008-06-20 20:48
Messages (4)
msg68463 - (view) Author: robert forkel (xrotwang) Date: 2008-06-20 15:16
when serializing elementtrees with weird namespaces like {$stuff}, the
generated xml is not valid:

Python 2.5.1 (r251:54863, Mar  7 2008, 04:10:12)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2

IDLE 1.2.1      ==== No Subprocess ====
>>> from xml.etree import ElementTree as et
>>> e = et.fromstring('<prefix:localname xmlns:prefix="${stuff}"/>')
>>> e.tag
'{${stuff}}localname'
>>> t = et.ElementTree(e)
>>> from StringIO import StringIO
>>> f = StringIO()
>>> t.write(f)
>>> f.seek(0)
>>> print f.read()
<ns0:}localname xmlns:ns0="${stuff" />
msg68475 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-06-20 20:48
A one-letter fix :-)
(the localname cannot contain special characters)
msg99397 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-02-16 11:58
Thanks for the one-letter fix.

Test added to the upgrade proposed on #6472.
msg100862 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-03-11 14:53
Fixed in trunk.
History
Date User Action Args
2022-04-11 14:56:35adminsetgithub: 47401
2010-03-11 14:53:28floxsetstatus: open -> closed
superseder: Update ElementTree with upstream changes
messages: + msg100862

dependencies: - Update ElementTree with upstream changes
resolution: fixed
stage: patch review -> resolved
2010-02-16 11:58:48floxsetversions: + Python 3.2
nosy: + flox

messages: + msg99397

dependencies: + Update ElementTree with upstream changes
2009-07-04 03:22:11ezio.melottisetpriority: normal
stage: patch review
versions: + Python 2.7, - Python 2.5
2008-06-20 23:36:07akuchlingsetkeywords: + easy
2008-06-20 20:48:04amaury.forgeotdarcsetfiles: + etree.patch
assignee: effbot
messages: + msg68475
keywords: + patch
nosy: + amaury.forgeotdarc, effbot
2008-06-20 15:16:20xrotwangcreate