Clarification: DomDocument->dump_mem adds the <?xml version="1.0"?> header, with some additional options.
header("Content-Type: application/xhtml+xml");
forces xml processing (this can also be a server setting). Idealy, both should be used for serving xhtml, though the <?xml version="1.0"?> may be dropped - on its own, it does not XML processing.