Commit 2966c343 by Michele Lazzeri

correct complex data xml parsing

parent 6b3792ae
...@@ -187,7 +187,6 @@ class XMLParser(BaseParser): ...@@ -187,7 +187,6 @@ class XMLParser(BaseParser):
`data` will simply be a string representing the body of the request. `data` will simply be a string representing the body of the request.
`files` will always be `None`. `files` will always be `None`.
""" """
data = {}
tree = ET.parse(stream) tree = ET.parse(stream)
data = self._xml_convert(tree.getroot()) data = self._xml_convert(tree.getroot())
...@@ -203,12 +202,8 @@ class XMLParser(BaseParser): ...@@ -203,12 +202,8 @@ class XMLParser(BaseParser):
if len(children) == 0: if len(children) == 0:
return self._type_convert(element.text) return self._type_convert(element.text)
else: else:
if element.tag == "resource": # if the fist child tag is list-item means all children are list-item
data = [] if children[0].tag == "list-item":
for child in children:
data.append(self._xml_convert(child))
else:
if children[0].tag == "resource":
data = [] data = []
for child in children: for child in children:
data.append(self._xml_convert(child)) data.append(self._xml_convert(child))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment