1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/public/nsIDOMSerializer.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,53 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsISupports.idl" 1.10 + 1.11 +interface nsIOutputStream; 1.12 +interface nsIDOMNode; 1.13 + 1.14 +/** 1.15 + * The nsIDOMSerializer interface is really a placeholder till the W3C 1.16 + * DOM Working Group defines a mechanism for serializing DOM nodes. 1.17 + * An instance of this interface can be used to serialize a DOM document 1.18 + * or any DOM subtree. 1.19 + */ 1.20 + 1.21 +[scriptable, uuid(9fd4ba15-e67c-4c98-b52c-7715f62c9196)] 1.22 +interface nsIDOMSerializer : nsISupports 1.23 +{ 1.24 + /** 1.25 + * The subtree rooted by the specified element is serialized to 1.26 + * a string. 1.27 + * 1.28 + * @param root The root of the subtree to be serialized. This could 1.29 + * be any node, including a Document. 1.30 + * @returns The serialized subtree in the form of a Unicode string 1.31 + */ 1.32 + AString serializeToString(in nsIDOMNode root); 1.33 + 1.34 + /** 1.35 + * The subtree rooted by the specified element is serialized to 1.36 + * a byte stream using the character set specified. 1.37 + * @param root The root of the subtree to be serialized. This could 1.38 + * be any node, including a Document. 1.39 + * @param stream The byte stream to which the subtree is serialized. 1.40 + * @param charset The name of the character set to use for the encoding 1.41 + * to a byte stream. If this string is empty and root is 1.42 + * a document, the document's character set will be used. 1.43 + */ 1.44 + void serializeToStream(in nsIDOMNode root, in nsIOutputStream stream, 1.45 + in AUTF8String charset); 1.46 +}; 1.47 + 1.48 +%{ C++ 1.49 +#define NS_XMLSERIALIZER_CID \ 1.50 + { /* a6cf9124-15b3-11d2-932e-00805f8add32 */ \ 1.51 + 0xa6cf9124, 0x15b3, 0x11d2, \ 1.52 + {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} } 1.53 +#define NS_XMLSERIALIZER_CONTRACTID \ 1.54 +"@mozilla.org/xmlextras/xmlserializer;1" 1.55 +%} 1.56 +