nsIDOMSerializer

This interface is really a placeholder till the W3C DOM Working Group defines a mechanism for serializing DOM nodes. An instance of this interface can be used to serialize a DOM document or any DOM subtree.
Inherits from: nsISupports Last changed in Gecko 1.7

Implemented by: @mozilla.org/xmlextras/xmlserializer;1. To create an instance, use:

var domSerializer = Components.classes["@mozilla.org/xmlextras/xmlserializer;1"]
                    .createInstance(Components.interfaces.nsIDOMSerializer);

Method overview

void serializeToStream(in nsIDOMNode root, in nsIOutputStream stream, in AUTF8String charset);
AString serializeToString(in nsIDOMNode root);

Methods

serializeToStream()

The subtree rooted by the specified element is serialized to a byte stream using the character set specified.

void serializeToStream(
  in nsIDOMNode root,
  in nsIOutputStream stream,
  in AUTF8String charset
);
Parameters
root
The root of the subtree to be serialized. This could be any node, including a Document.
stream
The byte stream to which the subtree is serialized.
charset
The name of the character set to use for the encoding to a byte stream. If this string is empty and root is a document, the document's character set will be used.

serializeToString()

The subtree rooted by the specified element is serialized to a string.

AString serializeToString(
  in nsIDOMNode root
);
Parameters
root
The root of the subtree to be serialized. This could be any node, including a Document.
Return value

The serialized subtree in the form of a Unicode string.

Document Tags and Contributors

Contributors to this page: Sheppy, trevorh
Last updated by: Sheppy,