parseFromString

open external fun parseFromString(string: String, type: DOMParserSupportedType): Document(source)

The parseFromString() method of the DOMParser interface parses an input containing either HTML or XML, returning a Document with the type given in the contentType property.

MDN Reference