#!/usr/bin/python import xml.dom.minidom import time dom = xml.dom.minidom.parse("errorintroducer.xml") timerList = dom.getElementsByTagName("timerList") for child in timerList[0].childNodes: if (child.nodeType == xml.dom.minidom.Node.ELEMENT_NODE): print "found element " + child.getAttribute("name") if (child.tagName == "timeItem"): timerList[0].removeChild(child) child.unlink() print " .. removed" print "-----------everything removed from timerList[0]---------------" for child in timerList[0].childNodes: if (child.nodeType == xml.dom.minidom.Node.ELEMENT_NODE): if (child.tagName == "timeItem"): print "found Element " + child.getAttribute("name")