mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-25 00:34:21 +03:00
correct complex data xml parsing
This commit is contained in:
parent
6b3792aef2
commit
2966c34352
|
@ -187,7 +187,6 @@ class XMLParser(BaseParser):
|
|||
`data` will simply be a string representing the body of the request.
|
||||
`files` will always be `None`.
|
||||
"""
|
||||
data = {}
|
||||
tree = ET.parse(stream)
|
||||
data = self._xml_convert(tree.getroot())
|
||||
|
||||
|
@ -203,12 +202,8 @@ class XMLParser(BaseParser):
|
|||
if len(children) == 0:
|
||||
return self._type_convert(element.text)
|
||||
else:
|
||||
if element.tag == "resource":
|
||||
data = []
|
||||
for child in children:
|
||||
data.append(self._xml_convert(child))
|
||||
else:
|
||||
if children[0].tag == "resource":
|
||||
# if the fist child tag is list-item means all children are list-item
|
||||
if children[0].tag == "list-item":
|
||||
data = []
|
||||
for child in children:
|
||||
data.append(self._xml_convert(child))
|
||||
|
|
Loading…
Reference in New Issue
Block a user