Name

DOMParser.parseFromString( ): parse XML markup

Synopsis

Document parseFromString(Stringtext,
                         String contentType)

Arguments

text

The XML markup to parse.

contentType

The content type of the text. This may be one of “text/xml”, “application/xml”, or “application/xhtml+xml”. Note that “text/html” is not supported.

Returns

A Document object that holds the parsed representation of text. See Document.loadXML( ) for an IE-specific alternative to this method.

Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.