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: normalize namespace from minidom
Type: behavior Stage: patch review
Components: XML Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: open Resolution:
Dependencies: 1371937 Superseder:
Assigned To: Nosy List: admp, ajaksu2, jorend, paulpach
Priority: normal Keywords: patch

Created on 2006-12-23 20:01 by paulpach, last changed 2022-04-11 14:56 by admin.

Files
File name Uploaded Description Edit
normalizeNamespace.diff paulpach, 2006-12-24 15:29 normalizeNamespace.diff
test_toxml.py paulpach, 2006-12-24 15:32 test_toxml.py
Messages (7)
msg51605 - (view) Author: Paul Pacheco (paulpach) Date: 2006-12-23 20:01
This is a patch that fixes bug 1371937, along with a test case that reproduces the original problem.

The patch is a port of the algorithm described here pretty much verbatim:
http://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#normalizeDocumentAlgo

to resolve namespace declarations. The patch also calls the normalizeNamespace method before calling writexml

Note the patch is against minidom that comes with python 2.5, NOT WITH PYXML. I need this for an embedded project where pyxml is too big.

msg51606 - (view) Author: Paul Pacheco (paulpach) Date: 2006-12-23 20:02
File Added: normalizeNamespace.diff
msg51607 - (view) Author: Paul Pacheco (paulpach) Date: 2006-12-24 15:29
File Added: normalizeNamespace.diff
msg51608 - (view) Author: Paul Pacheco (paulpach) Date: 2006-12-24 15:32
File Added: test_toxml.py
msg51609 - (view) Author: Jason Orendorff (jorend) Date: 2007-03-15 03:03
Thanks for the patch.

I think this is probably *not* desirable in this form.  As a side effect of writexml(), this fixes up tagNames and attributes of elements in the document.  DOM Level 3 Load and Save made the opposite decision:  "The XML data is written to a string or an output stream. Any changes or fixups made during the serialization affect only the serialized data. The Document object and its children are never altered by the serialization operation."  -- http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save.html#LS-LSSerializer (first paragraph)  I think that is the right approach.

The new method Element.normalizeNamespace() isn't really a DOM method, though the appendix sort of makes it look that way.

Incomplete - no doc patch.  (I think there's also a bug in the line added to Document.writexml()-- can't Documents have children that aren't Elements?)
msg84599 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2009-03-30 18:04
Patch has tests, fixes issue 1371937.
msg110515 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-16 22:18
msg51609 doesn't seem too enthusiastic about the patch.  msg84599 states unit tests are provided and #1371937 is fixed.  Can we have a definitive statement as to whether the patch is acceptable or not.
History
Date User Action Args
2022-04-11 14:56:21adminsetgithub: 44376
2014-02-03 19:21:26BreamoreBoysetnosy: - BreamoreBoy
2010-07-16 22:18:11BreamoreBoysetnosy: + BreamoreBoy

messages: + msg110515
versions: + Python 3.2
2010-05-21 20:23:14admpsetnosy: + admp
2009-03-30 22:36:37ajaksu2linkissue1371937 superseder
2009-03-30 18:04:08ajaksu2setdependencies: + minidom namespace problems
type: behavior
versions: + Python 3.1, Python 2.7, - Python 2.5
nosy: + ajaksu2

messages: + msg84599
stage: patch review
2006-12-23 20:01:44paulpachcreate