Go to the documentation of this file.00001
00002
00003
00004 import sys
00005 from xml.dom.minidom import parse
00006 import re
00007
00008 def main(from_file, to_file):
00009 root = parse(from_file)
00010
00011
00012
00013 links = root.getElementsByTagName("link")
00014 joints = root.getElementsByTagName("joint")
00015 for link in links:
00016 name = link.getAttribute("name")
00017 if re.match(".*_cb_link$", name):
00018 link.parentNode.removeChild(link)
00019 for joint in joints:
00020 name = joint.getAttribute("name")
00021 if re.match(".*_cb$", name):
00022 joint.parentNode.removeChild(joint)
00023 with open(to_file, "w") as f:
00024 f.write(root.toxml())
00025
00026
00027 if __name__ == "__main__":
00028 main(sys.argv[1], sys.argv[2])