|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
|
3 * You can obtain one at http://mozilla.org/MPL/2.0/. |
|
4 * |
|
5 * The origin of this IDL file is |
|
6 * http://domparsing.spec.whatwg.org/#the-domparser-interface |
|
7 */ |
|
8 |
|
9 interface Principal; |
|
10 interface URI; |
|
11 interface InputStream; |
|
12 |
|
13 enum SupportedType { |
|
14 "text/html", |
|
15 "text/xml", |
|
16 "application/xml", |
|
17 "application/xhtml+xml", |
|
18 "image/svg+xml" |
|
19 }; |
|
20 |
|
21 // the latter is Mozilla-specific |
|
22 [Constructor, |
|
23 Constructor(Principal? prin, optional URI? documentURI = null, |
|
24 optional URI? baseURI = null)] |
|
25 interface DOMParser { |
|
26 [NewObject, Throws] |
|
27 Document parseFromString(DOMString str, SupportedType type); |
|
28 |
|
29 // Mozilla-specific stuff |
|
30 // Throws if the passed-in length is greater than the actual sequence length |
|
31 [NewObject, Throws, ChromeOnly] |
|
32 Document parseFromBuffer(sequence<octet> buf, unsigned long bufLen, |
|
33 SupportedType type); |
|
34 // Throws if the passed-in length is greater than the actual typed array length |
|
35 [NewObject, Throws, ChromeOnly] |
|
36 Document parseFromBuffer(Uint8Array buf, unsigned long bufLen, |
|
37 SupportedType type); |
|
38 [NewObject, Throws, ChromeOnly] |
|
39 Document parseFromStream(InputStream stream, DOMString? charset, |
|
40 long contentLength, SupportedType type); |
|
41 [Throws, ChromeOnly] |
|
42 void init(optional Principal? principal = null, |
|
43 optional URI? documentURI = null, |
|
44 optional URI? baseURI = null); |
|
45 }; |
|
46 |