"""
Load the record from a dictionary
"""
+
self.set_name(dict['hrn'])
gidstr = dict.get("gid", None)
if gidstr:
representation of the record.
"""
#dict = xmlrpclib.loads(str)[0][0]
-
+
record = XML(str)
- self.load_from_dict(record.todict())
+ self.load_from_dict(record.todict2())
##
# Dump the record to stdout
if child.tag not in d:
d[child.tag] = []
d[child.tag].append(self.todict(child))
- return d
+ return d
+
+ # XXX smbaker, for record.load_from_string
+ def todict2(self, elem=None):
+ if elem is None:
+ elem = self.root
+ d = {}
+ d.update(elem.attrib)
+ d['text'] = elem.text
+ for child in elem.iterchildren():
+ if child.tag not in d:
+ d[child.tag] = []
+ d[child.tag].append(self.todict2(child))
+
+ if len(d)==1 and ("text" in d):
+ d = d["text"]
+
+ return d
def save(self, filename):
f = open(filename, 'w')