|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 |
|
8 interface nsIOutputStream; |
|
9 interface nsIDOMNode; |
|
10 |
|
11 /** |
|
12 * The nsIDOMSerializer interface is really a placeholder till the W3C |
|
13 * DOM Working Group defines a mechanism for serializing DOM nodes. |
|
14 * An instance of this interface can be used to serialize a DOM document |
|
15 * or any DOM subtree. |
|
16 */ |
|
17 |
|
18 [scriptable, uuid(9fd4ba15-e67c-4c98-b52c-7715f62c9196)] |
|
19 interface nsIDOMSerializer : nsISupports |
|
20 { |
|
21 /** |
|
22 * The subtree rooted by the specified element is serialized to |
|
23 * a string. |
|
24 * |
|
25 * @param root The root of the subtree to be serialized. This could |
|
26 * be any node, including a Document. |
|
27 * @returns The serialized subtree in the form of a Unicode string |
|
28 */ |
|
29 AString serializeToString(in nsIDOMNode root); |
|
30 |
|
31 /** |
|
32 * The subtree rooted by the specified element is serialized to |
|
33 * a byte stream using the character set specified. |
|
34 * @param root The root of the subtree to be serialized. This could |
|
35 * be any node, including a Document. |
|
36 * @param stream The byte stream to which the subtree is serialized. |
|
37 * @param charset The name of the character set to use for the encoding |
|
38 * to a byte stream. If this string is empty and root is |
|
39 * a document, the document's character set will be used. |
|
40 */ |
|
41 void serializeToStream(in nsIDOMNode root, in nsIOutputStream stream, |
|
42 in AUTF8String charset); |
|
43 }; |
|
44 |
|
45 %{ C++ |
|
46 #define NS_XMLSERIALIZER_CID \ |
|
47 { /* a6cf9124-15b3-11d2-932e-00805f8add32 */ \ |
|
48 0xa6cf9124, 0x15b3, 0x11d2, \ |
|
49 {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} } |
|
50 #define NS_XMLSERIALIZER_CONTRACTID \ |
|
51 "@mozilla.org/xmlextras/xmlserializer;1" |
|
52 %} |
|
53 |