Write/Parse Data from DataGrid to XML file

Im working on a simple admin CMS, where Im able to load XML data into a dataGrid component using the XML connector and datsSet component. Now I am at the stage where Im trying to figure out how to save the data, or write over the existing xml file. But I have no clue.

The XML structure thats loaded looks like this:

<?xml version="1.0" encoding="iso-8859-1"?>
<data>
    <button name="Button 1" link="www.yourlink.com"/>
    <button name="Button 2" link="www.yourlink.com"/>
    <button name="Button 3" link="www.yourlink.com"/>
    <button name="Button 4" link="www.yourlink.com"/>
    <button name="Button 5" link="www.yourlink.com"/>
    <button name="Button 6" link="www.yourlink.com"/>
    <button name="Button 7" link="www.yourlink.com"/>
</data>

Can someone help me with a PHP script that will convert the data entered into the dataGrid and produce and XML structure like above. Iv looked at the News editor tutorial and the source but components werent used so im freaking out right now. :puzzle:

Thanks :beer:

Using php to write the xml or edit it will be kinda tricky and a pain. I’ve asked many a php developer to do this, and they’ve all grumbled saying its more work than its worth and the time it will take the php to write / edit the xml will take longer than anyone really wants. I’d look into using a database if at all possible. XML is so handy, use it all the time, but for back/forth communication w/ data, a db works much quicker and easier (imo). One place to start if you can use mySQL would be http://www.amfphp.org