Export file as DOMDocument to keep XML formatting