createDocument

fun createDocument(namespace: String?, qualifiedName: String?, doctype: DocumentType? = definedExternally): XMLDocument(source)

MDN Reference