Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b9cd72a9
Commit
b9cd72a9
authored
Oct 15, 2010
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#5762: fix handling of empty namespace in minidom, which would result in AttributeError on toxml().
parent
d4460aaa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
3 deletions
+14
-3
Lib/test/test_minidom.py
Lib/test/test_minidom.py
+7
-0
Lib/xml/dom/minidom.py
Lib/xml/dom/minidom.py
+4
-3
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_minidom.py
View file @
b9cd72a9
...
...
@@ -1489,6 +1489,13 @@ class MinidomTest(unittest.TestCase):
doc
.
appendChild
(
doc
.
createComment
(
"foo--bar"
))
self
.
assertRaises
(
ValueError
,
doc
.
toxml
)
def
testEmptyXMLNSValue
(
self
):
doc
=
parseString
(
"<element xmlns=''>
\
n
"
"<foo/>
\
n
</element>"
)
doc2
=
parseString
(
doc
.
toxml
())
self
.
confirm
(
doc2
.
namespaceURI
==
xml
.
dom
.
EMPTY_NAMESPACE
)
def
test_main
():
run_unittest
(
MinidomTest
)
...
...
Lib/xml/dom/minidom.py
View file @
b9cd72a9
...
...
@@ -301,9 +301,10 @@ def _in_document(node):
def
_write_data
(
writer
,
data
):
"Writes datachars to writer."
data
=
data
.
replace
(
"&"
,
"&"
).
replace
(
"<"
,
"<"
)
data
=
data
.
replace
(
"
\
"
"
,
"""
).
replace
(
">"
,
">"
)
writer
.
write
(
data
)
if
data
:
data
=
data
.
replace
(
"&"
,
"&"
).
replace
(
"<"
,
"<"
).
\
replace
(
"
\
"
"
,
"""
).
replace
(
">"
,
">"
)
writer
.
write
(
data
)
def
_get_elements_by_tagName_helper
(
parent
,
name
,
rc
):
for
node
in
parent
.
childNodes
:
...
...
Misc/NEWS
View file @
b9cd72a9
...
...
@@ -24,6 +24,9 @@ Core and Builtins
Library
-------
- Issue #5762: Fix AttributeError raised by ``xml.dom.minidom`` when an empty
XML namespace attribute is encountered.
- Issue #2830: Add the ``html.escape()`` function, which quotes all problematic
characters by default. Deprecate ``cgi.escape()``.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment