Skip to content

Commit

Permalink
Don't strip whitespace in xml text values
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Moore authored and sanand0 committed Apr 25, 2020
1 parent 5be69e0 commit 20817db
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions xmljson/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ def data(self, root):
attr = attr if self.attr_prefix is None else self.attr_prefix + attr
value[attr] = self._fromstring(attrval)
if root.text and self.text_content is not None:
text = root.text.strip()
if text:
text = root.text
if text.strip():
if self.simple_text and len(children) == len(root.attrib) == 0:
value = self._fromstring(text)
else:
Expand Down Expand Up @@ -245,8 +245,8 @@ def data(self, root):

# Add root text
if root.text and self.text_content is not None:
text = root.text.strip()
if text:
text = root.text
if text.strip():
if self.simple_text and len(children) == len(root.attrib) == 0:
value = self._fromstring(text)
else:
Expand Down Expand Up @@ -328,8 +328,8 @@ def data(self, root):

# Add root text
if root.text and self.text_content is not None:
text = root.text.strip()
if text:
text = root.text
if text.strip():
if self.simple_text and len(children) == len(root.attrib) == 0:
value = self._fromstring(text)
else:
Expand Down

0 comments on commit 20817db

Please sign in to comment.