Edit XML file while parsing with System Events

I’m trying to modify a ton of XML files.
I’ve been able to write a script that uses the XML parsing abilities of System Events to dig through elements and attributes and get to the element I need to edit.
The problem is that now I don’t know how to edit that element on the file!

Let’s assume for learning purposes this file

link1.com link2.com link3.com

I need to change the attribute “url” in each element “item” to the value of the “link” element. :smiley:
to get something like “link1.com

I am able to write a script that goes through every element and selects the proper attribute and read the value.
I just don’t know how to write to the xml file in that specific place I navigated to with System Events.

Anybody has any ideas?
(Please keep in mind that the real files are different, very large, and full of elements I don’t need to edit, this is just an example.)


  • Martín.