Can anybody help me to parse xml based preset files?

I am trying to replace an attribute value of a xml file but it has turned into a big problem for me. I have my own preset management system to store parameters. Actually i am just extracting the parameters as xml files. Now i need to parse them. One of my parameter is “presetindex” . So it should be updated when a new preset is created because i sort them alphabetically. When a new preset is created, others should be sorted again and their presetindex attribute should be updated. I am not good at xml parsing but this takes my whole time and still couldn’t find a proper way to do it.

Could you please check this post and help me to solve this issue?