So I have some XML like this:
<bar>
<foo>Something</foo>
<baz>
<foo>Hello</foo>
<zap>Another</zap>
<baz>
<bar>
And I want to remove all the foo nodes. Something like this doesn't work
params = xml.xpath('//foo')
for n in params:
xml.getroot().remove(n)
Giving
ValueError: Element is not a child of this node.
What is a neat way to do this?