Skip to content

Commit 840bf3f

Browse files
authored
Revert "Ensure significant whitespace is not trimmed"
This reverts commit c9f1143.
1 parent 34759c3 commit 840bf3f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tests/test_xmltodict.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ def test_skip_whitespace(self):
9393
"""
9494
self.assertEqual(
9595
parse(xml),
96-
{'root': {'emptya': " ",
96+
{'root': {'emptya': None,
9797
'emptyb': {'@attr': 'attrvalue'},
9898
'value': 'hello'}})
9999

100100
def test_keep_whitespace(self):
101101
xml = "<root> </root>"
102-
self.assertEqual(parse(xml), dict(root=' '))
102+
self.assertEqual(parse(xml), dict(root=None))
103103
self.assertEqual(parse(xml, strip_whitespace=False),
104104
dict(root=' '))
105105

xmltodict.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def endElement(self, full_name):
123123
else self.cdata_separator.join(self.data))
124124
item = self.item
125125
self.item, self.data = self.stack.pop()
126-
if self.strip_whitespace and data and item:
126+
if self.strip_whitespace and data:
127127
data = data.strip() or None
128128
if data and self.force_cdata and item is None:
129129
item = self.dict_constructor()

0 commit comments

Comments
 (0)