elif node.attributes.has_key("name"):
name = node.attributes.get("name").value
return name
-
+
+
# Attribute. {name : nameofattribute, {items: values})
def _attributeDict(self, attributeDom):
'''Traverse single attribute node. Create a dict {attributename : {name: value,}]}'''
node[elementName][childName].append(value)
#node[childName].append(self.toDict(child))
return node
+
def toxml(self):
"""
convert this rspec to an xml string and return it.
"""
return self.rootNode.toxml()
+
def toprettyxml(self):
"""
print this rspec in xml in a pretty format.
"""
return self.rootNode.toprettyxml()
+
def parseFile(self, filename):
"""
xml = xml.replace('\n', '').replace('\t', '').strip()
dom = minidom.parseString(xml)
self.rootNode = dom.childNodes[0]
+
def dict2dom(self, rdict, include_doc = False):
"""
else:
rootNode = node
return rootNode
+
def parseDict(self, rdict, include_doc = True):
"""
dicts.append(value)
return dicts
-# vim:ts=4:expandtab
+# vim:ts=4:expandtab