I am trying to update the xml using object notation using lxml objectify.
<xml>
<fruit>
<citrus>
<lemon />
</citrus>
</fruit>
</xml>
I am trying to add another fruit called mango using lxml objectify like
root = lxml.objectify.fromstring(xml_string)
root.fruit.citrus = 'orange'
def update(path, value):
// code
update('fruit.citrus', 'orange')
I would like to pass a string like 'fruit.citrus' because I cannot pass an object fruit.citrus.
How do I achieve this in Python ie how do I execute the code 'root.fruit.citrus = 'orange' inside the update function. How to convert string to object?