From c283596b898a61e7a11db70c5f7d1675d0ad7bd7 Mon Sep 17 00:00:00 2001 From: Tony Mack <tmack@paris.CS.Princeton.EDU> Date: Thu, 30 Jun 2011 00:56:21 -0400 Subject: [PATCH] added recursive argument to get_attributes() --- sfa/rspecs/elements/element.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sfa/rspecs/elements/element.py b/sfa/rspecs/elements/element.py index 495ff3e6..898706eb 100644 --- a/sfa/rspecs/elements/element.py +++ b/sfa/rspecs/elements/element.py @@ -66,8 +66,11 @@ class Element: attrs['text'] = str(elem.text).strip() if recursive: for child_elem in list(elem): - attrs[str(child_elem.tag)] = self.get_attributes(child_elem, recursive) - + key = str(child_elem.tag) + if key not in attrs: + attrs[key] = [self.get_attributes(child_elem, recursive)] + else: + attrs[key].append(self.get_attributes(child_elem, recursive)) return attrs def attributes_list(self, elem): -- 2.47.0