From ad7d921e86198a81a8db2a991111218c798026b8 Mon Sep 17 00:00:00 2001 From: Michele Lazzeri Date: Wed, 11 Jan 2012 19:29:48 +0100 Subject: [PATCH] Revert "update author" This reverts commit f461acbaf28aa79d82cffaf65b886c3d884cc5f4. --- djangorestframework/parsers.py | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/djangorestframework/parsers.py b/djangorestframework/parsers.py index c5eefaec2..c218e5ee5 100644 --- a/djangorestframework/parsers.py +++ b/djangorestframework/parsers.py @@ -189,38 +189,11 @@ class XMLParser(BaseParser): """ data = {} tree = ET.parse(stream) - data = self._xml_convert(tree.getroot()) - + for child in tree.getroot().getchildren(): + data[child.tag] = self._type_convert(child.text) + return (data, None) - def _xml_convert(self, element): - """ - convert the xml `element` into the corresponding python object - - `data` The python object representation of xml `element`. - """ - - children = element.getchildren() - - 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": - data = [] - for child in children: - data.append(self._xml_convert(child)) - else: - data = {} - for child in children: - data[child.tag] = self._xml_convert(child) - - return data - def _type_convert(self, value): """ Converts the value returned by the XMl parse into the equivalent