Python to update XML SubElement

homework
python

#1

Hi all,

I am looking for this help everywhere in the past days without success and I hope someone here can share some knowledge.
In the XML data below, how do I do for:
1 - Update the {id=“012345”/res name=“attrib1”/last_seem key} ‘date’ and ‘status’ attributes?
2 - Delete the {id=“012345”/res name="attrib2}
3 - Add a new {id=“123456”/res name=“attrib2”} with ‘first_seem’ and ‘last_seem’ keys and values

Important:

  • I am going to have hundred different users/IDs
  • I am going to have dozens res/attributes
1 0 1 0 1 0

So far I found help to update values in a fixed path (i.e: /root/user/res/lastseem.text), what did not help me.
I tried to use the same command used to create the XML above changing a single/desired value, but instead of update, Python created a new entry Sad

Thank you so much for any help.


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.