When I remove an element I usually append it to a list called “garbage” and then use
parent= element.getparent()
parent.remove(element)
This doesn’t work if the element is empty. It produces an error message saying that there is no parent. If I add some arbitrary child element to the element I want to remove, it works.
If I load the XML document in oXygen and select the empty element, it will give me its correct path. So the empty element as a parent. Is this a quirk or am I doing something wrong?