def asXml(self): rec = XmlRecord(xml="<accessionNumberMappings />") root = rec.doc root.setAttribute("date", time.asctime()) for drNum in self.keys(): mappingEl = rec.addElement(root, "mapping") self.populateMappingElement(mappingEl, drNum) return rec
def asXml(self): from JloXml import XmlRecord, XmlUtils import time rec = XmlRecord(xml="<%s />" % self.rootElementName) root = rec.doc root.setAttribute("date", time.asctime()) for drNum in self.keys(): mappingEl = rec.addElement(root, "mapping") self.populateMappingElement(mappingEl, drNum) return rec
def asXml(self): rec = XmlRecord(xml="<orgchart/>") root = rec.doc for org in self.values(): orgNode = rec.addElement(root, "node") orgNode.setAttribute("id", str(org.id)) # print "children: %s" % org.children children = XmlUtils.addElement(rec.dom, orgNode, "children") for child in org.children: # print "child: ", child XmlUtils.addChild(rec.dom, "child", str(child), children) XmlUtils.addChild(rec.dom, "parent", str(org.parent), orgNode) for attr in ['acronym', 'full_name', 'active', 'org_level_id']: val = getattr(org.orgRec, attr) XmlUtils.addChild(rec.dom, attr, str(val), orgNode) # print root.toxml() return rec