通过jquery ui拖放重新排序xml中的节点

I hope someone can help me here...

I am currently working on a small piece of code that will allow me to re-order nodes in an xml file via a jquery ui sortable interface.

Take the following xml file:

<Root>
   <Page1>
     <content>
       This is content 1
     </content>
   </Page1>
   <Page2>
     <content>
       This is content 2
     </content>
   </Page2>
   <Page3>
     <content>
       This is content 3
     </content>
   </Page3>
</Root>

I have been able to use php to to build a drag and drop interface based on the number of nodes in the xml file. What I am trying to achieve is a way of saving the new order of the xml files when the data is passed from the sortable interface. From the jquery ui, I can get the ids required and I am able to pass that onto php. My main issue is how to manipulate the xml file to get the following result:

<Root>
   <Page1>
     <content>
       This is content 3
     </content>
   </Page1>
   <Page2>
     <content>
       This is content 1
     </content>
   </Page2>
   <Page3>
     <content>
       This is content 2
     </content>
   </Page3>
</Root>

Hope this is making sense and I hope someone has an idea of how I can achieve this. Is it possible to do this with DOMDocument as I believe SimpleXML is not powerful enough to handle such a task.

My day would be made if a solution can be attained.

Thanks.