def toxml(self, filename): root = ET.Element("container") for modelClass in self.MODELCLASSES: models = [] for model in self.__modelsByClass[modelClass]: models.append(model) MODELS.toxml(modelClass.__name__, models, root, parseModel=True) tree = ET.ElementTree(root) tree.write(filename)
def toxml(self,filename): root = ET.Element("container") for modelClass in self.MODELCLASSES: models=[] for model in self.__modelsByClass[modelClass]: models.append(model) MODELS.toxml(modelClass.__name__,models,root,parseModel=True) tree = ET.ElementTree(root) tree.write(filename)
def fromxml(self, filename): tree = ET.ElementTree(file=filename) root = tree.getroot() for et in root: models = MODELS.fromxml(et, container=self) for model in models: self.register(model) return ET.ElementTree(root)
def fromxml(self,filename): tree = ET.ElementTree(file=filename) root = tree.getroot() for et in root: models = MODELS.fromxml(et,container=self) for model in models: self.register(model) return ET.ElementTree(root)