Skip to content

Commit dba35ef

Browse files
authored
Handle/parse XML attributes: jpadilla#16
Based on this issue: jpadilla#16 Changes to handle/parse XML attributes.
1 parent 71c2f88 commit dba35ef

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

rest_framework_xml/parsers.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ def _xml_convert(self, element):
5555
else:
5656
data = {}
5757
for child in children:
58-
data[child.tag] = self._xml_convert(child)
58+
if child.attrib:
59+
data[child.tag] = {
60+
'value': self._xml_convert(child),
61+
'attributes': child.attrib
62+
}
63+
else:
64+
data[child.tag] = self._xml_convert(child)
5965

6066
return data
6167

0 commit comments

Comments
 (0)