DOMParser: parseFromString() method - Web APIs | MDN (original) (raw)
Baseline
Widely available
The parseFromString()
method of the DOMParser interface parses a string containing either HTML or XML, returning an HTMLDocument or an XMLDocument.
Syntax
parseFromString(string, mimeType)
Parameters
The string to be parsed. It must contain either anHTML, xml, XHTML, orsvg document.
A string. This string determines whether the XML parser or the HTML parser is used to parse the string. Valid values are:
text/html
text/xml
application/xml
application/xhtml+xml
image/svg+xml
A value of text/html
will invoke the HTML parser, and the method will return an HTMLDocument. Any