Name
DOMParser: parses XML markup to create a Document â Firefox 1.0, Safari 2.01, Opera 7.60: Object â DOMParser
Constructor
new DOMParser( )
Methods
-
parseFromString( )
Parses XML markup and returns a Document.
Description
A DOMParser
object parses
XML text and returns an XML Document object. To use a DOMParser,
instantiate one with the no-argument constructor and then call its
parseFromString( )
method:
var doc = (new DOMParser( )).parseFromString(text
);
Internet Explorer does not support the DOMParser
object. Instead, it supports XML parsing with Document.loadXML( )
. Note that the
XMLHttpRequest object can also parse XML documents. See the responseXML
property of
XMLHttpRequest.
See Also
Document.loadXML( )
,
XMLHttpRequest
; Chapter 21
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.