added attributes_list() method0
authorTony Mack <tmack@paris.CS.Princeton.EDU>
Thu, 1 Sep 2011 18:24:56 +0000 (14:24 -0400)
committerTony Mack <tmack@paris.CS.Princeton.EDU>
Thu, 1 Sep 2011 18:24:56 +0000 (14:24 -0400)
sfa/rspecs/rspec.py

index 1a0c3ad..85c8c88 100755 (executable)
@@ -164,6 +164,15 @@ class RSpec:
             parent = element.getparent()
             parent.remove(element)
 
+    def attributes_list(self, elem):
+        # convert a list of attribute tags into list of tuples
+        # (tagnme, text_value)
+        opts = []
+        if elem is not None:
+            for e in elem:
+                opts.append((e.tag, str(e.text).strip()))
+        return opts
+
     def get_element_attributes(self, elem=None, depth=0):
         if elem == None:
             elem = self.root_node