Mozilla XUL Element and Script Reference

Contents  Quick Reference

DOMParser

This object is used to parse strings of text into DOM document trees. The two functions return documents from a string or stream of XML or HTML text.

Properties and Methods:

parseFromString ( stream , charset, length, contentType )

Returns a new document created by reading from the input stream, which is of type nsIInputStream. The length argument specifies how many bytes to read. The data is expected to be an HTML or XML document. You can specify which with the contentType argument, which should be either the string 'text/html' or 'text/xml'. You can optionally indicate a character set for the stream or use null to use the default.

parseFromString ( str , contentType )

Returns a new document created by parsing the string str. The string is expected to be an HTML or XML document. You can specify which with the contentType argument, which should be either the string 'text/html' or 'text/xml'.