I read an tree from a file as a string and remove from it namespaces.
with open(pathArxmlFileName, 'r') as myfile:
data=myfile.read();
data = re.sub(' xmlns="[^"]+"', '', data, count=1)
self.root = ET.fromstring(data);
self.tree = ET.ElementTree(self.root)
I want to remove an XML elemet from this tree
I tried:
for EL in self.root.iter('tagString'):
self.root.remove(EL);
This find EL elements but when I call remove() function gives error:
self._children.remove(element)
ValueError: list.remove(x): x not in list
Please help me , i dont know what to do :(
Ps:Modification of the tree by modifying an element value works