Conditions | 3 |
Total Lines | 10 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import logging |
||
20 | def _to_json(self, xml): |
||
21 | response = {} |
||
22 | for child in list(xml): |
||
23 | if len(list(child)) > 0: |
||
24 | response[child.tag] = self._to_json(child) |
||
25 | else: |
||
26 | response[child.tag] = child.text or "" |
||
27 | # one-liner equivalent |
||
28 | # response[child.tag] = parseXmlToJson(child) if len(list(child)) > 0 else child.text or '' |
||
29 | return response |
||
30 | |||
33 |