Unfortunately the native PHP's DOMDocument class does not allow you to create an xml document from a multidimensional array or save it to one.
Here is a class, which adds these capabilities - by using DOMDocumentExt you can now call loadArray or saveArray functions to do the loading and saving tasks respectively.
As an added bonus you can also use function called getPathValue, which accepts one parameter - $path - a string in
root/child1/child2/../childN format. It will convert the current document tree to an array and will return the contents of the specified path if such exists (or null if such path does not exist).