def add_new_cates(xmlPath,referPath,addCates): addBoxes=XML.read_objects(referPath) tree = ET.ElementTree(file=xmlPath) root = tree.getroot() root=XML.del_tag(root,addCates) # print(addBoxes) for box in addBoxes: if box['name'] in addCates: root=XML.add_tag(root,box) XML.write_xml(tree,xmlPath)
def changeXmlLabelName(path, labelDict): tree = ET.ElementTree(file=path) root = tree.getroot() root = XML.del_tag(root, ["13"]) root = XML.chag_name(root, labelDict) XML.write_xml(tree, path)