def getRootChild (self, childName): if not childName in self.root_child_order: raise Exeption, 'Unrecognized childName: "%s"' % childName child = self.selectSingleNode(self.dom, 'record/'+childName) if not child: child = XmlUtils.addElement(self.dom, self.doc, childName) XmlUtils.orderElements(self.doc, self.root_child_order) return child
def addGeneralChild (self, childName): """ add a named child element to the /record/general node """ if not childName in self.general_child_order: raise Exeption, 'Unrecognized childName: "%s"' % childName general = self.getRootChild('general') child = XmlUtils.addElement(self.dom, general, childName) XmlUtils.orderElements(general, self.general_child_order) return child