I am using python xmlElementTree and want to assign or modify a xml element value based on its attribute. Can somebody give me an idea how to do this?
For example: Here
larsks explains how to use XPath to find what you are after very well. You also wanted to change an attribute. The best way is probably to add a new attribute and remove the original. Once you get the nodes result, it is a list with a single entry (number).
# This returns sys/phoneNumber/1
nodes[0].get("topic")
# To change the value, use set
nodes[0].set("topic", "new/value/of/phone/number")
Hope this helps.
Also, your ending root tag doesn't close properly.