Converts an XML DOMDocument to an array, and back.