Imam XML dokument u kojem želim tražiti neke elemente i ako oni odgovaraju nekim kriterijima Želio bih ih izbrisati
Međutim, čini mi se da ne mogu pristupiti nadređenom elementu tako da ga mogu izbrisati
file = open('test.xml', "r")
elem = ElementTree.parse(file)
namespace = "{http://somens}"
props = elem.findall('.//{0}prop'.format(namespace))
for prop in props:
type = prop.attrib.get('type', None)
if type == 'json':
value = json.loads(prop.attrib['value'])
if value['name'] == 'Page1.Button1':
#here I need to access the parent of prop
# in order to delete the prop
Postoji li način da to učinim?
Hvala