Hi.
I have the following XML file:
<book>
<bookname child="test">
<text> Works </text>
<text> Doesn't work </text>
</bookname>
</book>
This is just a one block, there are more than one <bookname>
tags. I need to iterate through the whole document and remove specific <text>
tags. How do I do that?
My approach is to create an ElementTree
first and then get an Element
instance using ElementTree.getroot()
. Then I use Element.clear()
. Is this approach ok? I had want to use Element.remove()
but I can't get it to work. Can anyone provide me with a sample syntax.
Thank you for the help!