Use DOMDocument class for output