nsIDOMSerializer 编辑

content/base/public/nsIDOMSerializer.idlScriptable 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:84 次

字数:2972

最后编辑:6年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文