Fix some formatting and import DOMDocument

DOMDocument needs to be imported as it is not in the correct namespace.