WARNING: Most of this content (with the exception of the Mozilla 1.9 XPCOM reference) is very old, and can be expected to be out of date and possibly obsolete. For better XUL documentation, please visit the XUL hub at the Mozilla Developer Center.

DOMParser

This object is available to unprivileged JavaScript. It implements the following interfaces:

Properties

nsIURI baseURI

Set/Get the baseURI, may be needed when called from native code.


Methods

Document parseFromBuffer ( arrayof PRUint8 buf , int bufLen , char* contentType ) Document parseFromStream ( nsIInputStream stream , char* charset , PRInt32 contentLength , char* contentType ) Document parseFromString ( PRUnichar* str , char* contentType )

Document parseFromBuffer ( arrayof PRUint8 buf , int bufLen , char* contentType )

The buffer is parsed into a DOM document. The charset is determined from the xml entity decl.

Arguments:
buf: The octet array data to be parsed
bufLen: Length (in bytes) of the data
contentType: The content type of the data (see parseFromStream)

Document parseFromStream ( nsIInputStream stream , char* charset , PRInt32 contentLength , char* contentType )

The byte stream passed in is parsed into a DOM document.

Not accessible from web content.

Arguments:
stream: The byte stream whose contents are parsed
charset: The character set that was used to encode the byte stream. NULL if not specified.
contentLength: The number of bytes in the input stream.
contentType: The content type of the string - either text/xml, application/xml, or application/xhtml+xml. Must not be NULL.

Document parseFromString ( PRUnichar* str , char* contentType )

The string passed in is parsed into a DOM document.

Arguments:
str: The UTF16 string to be parsed
contentType: The content type of the string (see parseFromStream)

Reference documentation is generated from Mozilla's source.