We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a4f4b6e commit 7f2c33eCopy full SHA for 7f2c33e
1 file changed
libcomxml/core/__init__.py
@@ -17,6 +17,7 @@
17
import xml.etree.cElementTree as etree
18
except ImportError:
19
import xml.etree.ElementTree as etree
20
+import re
21
22
23
def get_xml_default_encoding():
@@ -25,6 +26,10 @@ def get_xml_default_encoding():
25
26
return xml_enc
27
28
29
+def clean_xml(xml_string):
30
+ return re.sub('\s+<', '<', xml_string)
31
+
32
33
class Field(object):
34
"""Base Field class
35
"""
@@ -249,7 +254,7 @@ def build_tree(self):
249
254
continue
250
255
self.doc_root.append(item.doc_root)
251
256
elif isinstance(item, str):
252
- ele = etree.fromstring(item)
257
+ ele = etree.fromstring(clean_xml(item))
253
258
self.doc_root.append(ele)
259
item = None
260
elif (field.parent or self.root.name) == self.root.name:
0 commit comments