def replace_self(self, newelm): """Replace the element with a new element""" elementid, parent = summon_core.get_element_parent(self.ptr) if parent == 0: raise Exception("element has no parent, cannot replace") else: summon_core.replace_group2(parent, self.ptr, newelm) return newelm
def replace(self, oldchild, newchild): """Replace a child element 'oldchild' with a new child 'newchild'""" summon_core.replace_group2(self.ptr, oldchild.ptr, newchild) return newchild