Skip to content

Determine is_list if first and last children are with same tag #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions rest_framework_xml/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ def _xml_convert(self, element):
if len(children) == 0:
return self._type_convert(element.text)
else:
# if the fist child tag is list-item means all children are list-item
if children[0].tag == "list-item":
# check tag of first and last children to determine if it is a list
# also avoid if len( children ) is one
if children[0].tag == children[-1].tag:
data = []
for child in children:
data.append(self._xml_convert(child))
Expand Down