XPSEDAPI
 All Classes Namespaces Files Functions Variables Typedefs
DOM_APISPEC.idl
Go to the documentation of this file.
1 /*
2  * Note: This file is derived from the W3C version of the DOM specification;
3  * it has been changed to make all interfaces derive from XPCOM::IObject.
4  */
5 // File: dom.idl
6 
7 #ifndef _DOM_IDL_
8 #define _DOM_IDL_
9 
10 #include "xpcom.idl"
11 
12 
18 module dom
19 {
20 
21  typedef wstring DOMString;
22 
23  typedef unsigned long long DOMTimeStamp;
24 
25  interface DocumentType;
26  interface Document;
27  interface NodeList;
28  interface NamedNodeMap;
29  interface Element;
30 
31  exception DOMException {
32  unsigned short code;
33  };
34  // ExceptionCode
35  const unsigned short INDEX_SIZE_ERR = 1;
36  const unsigned short DOMSTRING_SIZE_ERR = 2;
37  const unsigned short HIERARCHY_REQUEST_ERR = 3;
38  const unsigned short WRONG_DOCUMENT_ERR = 4;
39  const unsigned short INVALID_CHARACTER_ERR = 5;
40  const unsigned short NO_DATA_ALLOWED_ERR = 6;
41  const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
42  const unsigned short NOT_FOUND_ERR = 8;
43  const unsigned short NOT_SUPPORTED_ERR = 9;
44  const unsigned short INUSE_ATTRIBUTE_ERR = 10;
45  // Introduced in DOM Level 2:
46  const unsigned short INVALID_STATE_ERR = 11;
47  // Introduced in DOM Level 2:
48  const unsigned short SYNTAX_ERR = 12;
49  // Introduced in DOM Level 2:
50  const unsigned short INVALID_MODIFICATION_ERR = 13;
51  // Introduced in DOM Level 2:
52  const unsigned short NAMESPACE_ERR = 14;
53  // Introduced in DOM Level 2:
54  const unsigned short INVALID_ACCESS_ERR = 15;
55 
56 
58  boolean hasFeature(in DOMString feature,
59  in DOMString version);
60  // Introduced in DOM Level 2:
61  DocumentType createDocumentType(in DOMString qualifiedName,
62  in DOMString publicId,
63  in DOMString systemId)
64  raises(DOMException);
65  // Introduced in DOM Level 2:
66  Document createDocument(in DOMString namespaceURI,
67  in DOMString qualifiedName,
68  in DocumentType doctype)
69  raises(DOMException);
70  };
71 
72  interface Node : XPCOM::IObject {
73 
74  // NodeType
75  const unsigned short ELEMENT_NODE = 1;
76  const unsigned short ATTRIBUTE_NODE = 2;
77  const unsigned short TEXT_NODE = 3;
78  const unsigned short CDATA_SECTION_NODE = 4;
79  const unsigned short ENTITY_REFERENCE_NODE = 5;
80  const unsigned short ENTITY_NODE = 6;
81  const unsigned short PROCESSING_INSTRUCTION_NODE = 7;
82  const unsigned short COMMENT_NODE = 8;
83  const unsigned short DOCUMENT_NODE = 9;
84  const unsigned short DOCUMENT_TYPE_NODE = 10;
85  const unsigned short DOCUMENT_FRAGMENT_NODE = 11;
86  const unsigned short NOTATION_NODE = 12;
87 
88  readonly attribute DOMString nodeName;
89  attribute DOMString nodeValue;
90  // raises(DOMException) on setting
91  // raises(DOMException) on retrieval
92 
93  readonly attribute unsigned short nodeType;
94  readonly attribute Node parentNode;
95  readonly attribute NodeList childNodes;
96  readonly attribute Node firstChild;
97  readonly attribute Node lastChild;
98  readonly attribute Node previousSibling;
99  readonly attribute Node nextSibling;
100  readonly attribute NamedNodeMap attributes;
101  // Modified in DOM Level 2:
102  readonly attribute Document ownerDocument;
103  Node insertBefore(in Node newChild,
104  in Node refChild)
105  raises(DOMException);
106  Node replaceChild(in Node newChild,
107  in Node oldChild)
108  raises(DOMException);
109  Node removeChild(in Node oldChild)
110  raises(DOMException);
111  Node appendChild(in Node newChild)
112  raises(DOMException);
113  boolean hasChildNodes();
114  Node cloneNode(in boolean deep);
115  // Modified in DOM Level 2:
116  void normalize();
117  // Introduced in DOM Level 2:
118  boolean isSupported(in DOMString feature,
119  in DOMString version);
120  // Introduced in DOM Level 2:
121  readonly attribute DOMString namespaceURI;
122  // Introduced in DOM Level 2:
123  attribute DOMString prefix;
124  // raises(DOMException) on setting
125 
126  // Introduced in DOM Level 2:
127  readonly attribute DOMString localName;
128  // Introduced in DOM Level 2:
129  boolean hasAttributes();
130  };
131 
132  interface NodeList : XPCOM::IObject {
133  Node item(in unsigned long index);
134  readonly attribute unsigned long length;
135  };
136 #pragma cross-module-argument
137 
139  Node getNamedItem(in DOMString name);
140  Node setNamedItem(in Node arg)
141  raises(DOMException);
142  Node removeNamedItem(in DOMString name)
143  raises(DOMException);
144  Node item(in unsigned long index);
145  readonly attribute unsigned long length;
146  // Introduced in DOM Level 2:
147  Node getNamedItemNS(in DOMString namespaceURI,
148  in DOMString localName);
149  // Introduced in DOM Level 2:
150  Node setNamedItemNS(in Node arg)
151  raises(DOMException);
152  // Introduced in DOM Level 2:
153  Node removeNamedItemNS(in DOMString namespaceURI,
154  in DOMString localName)
155  raises(DOMException);
156  };
157 #pragma terminal-interface
158 
159  interface CharacterData : Node {
160  attribute DOMString data;
161  // raises(DOMException) on setting
162  // raises(DOMException) on retrieval
163 
164  readonly attribute unsigned long length;
165  DOMString substringData(in unsigned long offset,
166  in unsigned long count)
167  raises(DOMException);
168  void appendData(in DOMString arg)
169  raises(DOMException);
170  void insertData(in unsigned long offset,
171  in DOMString arg)
172  raises(DOMException);
173  void deleteData(in unsigned long offset,
174  in unsigned long count)
175  raises(DOMException);
176  void replaceData(in unsigned long offset,
177  in unsigned long count,
178  in DOMString arg)
179  raises(DOMException);
180  };
181 
182  interface Attr : Node {
183  readonly attribute DOMString name;
184  readonly attribute boolean specified;
185  attribute DOMString value;
186  // raises(DOMException) on setting
187 
188  // Introduced in DOM Level 2:
189  readonly attribute Element ownerElement;
190  };
191 #pragma terminal-interface
192 
193  interface Element : Node {
194  readonly attribute DOMString tagName;
195  DOMString getAttribute(in DOMString name);
196  void setAttribute(in DOMString name,
197  in DOMString value)
198  raises(DOMException);
199  void removeAttribute(in DOMString name)
200  raises(DOMException);
201  Attr getAttributeNode(in DOMString name);
202  Attr setAttributeNode(in Attr newAttr)
203  raises(DOMException);
204  Attr removeAttributeNode(in Attr oldAttr)
205  raises(DOMException);
206  NodeList getElementsByTagName(in DOMString name);
207  // Introduced in DOM Level 2:
208  DOMString getAttributeNS(in DOMString namespaceURI,
209  in DOMString localName);
210  // Introduced in DOM Level 2:
211  void setAttributeNS(in DOMString namespaceURI,
212  in DOMString qualifiedName,
213  in DOMString value)
214  raises(DOMException);
215  // Introduced in DOM Level 2:
216  void removeAttributeNS(in DOMString namespaceURI,
217  in DOMString localName)
218  raises(DOMException);
219  // Introduced in DOM Level 2:
220  Attr getAttributeNodeNS(in DOMString namespaceURI,
221  in DOMString localName);
222  // Introduced in DOM Level 2:
223  Attr setAttributeNodeNS(in Attr newAttr)
224  raises(DOMException);
225  // Introduced in DOM Level 2:
226  NodeList getElementsByTagNameNS(in DOMString namespaceURI,
227  in DOMString localName);
228  // Introduced in DOM Level 2:
229  boolean hasAttribute(in DOMString name);
230  // Introduced in DOM Level 2:
231  boolean hasAttributeNS(in DOMString namespaceURI,
232  in DOMString localName);
233  };
234 
235  interface Text : CharacterData {
236  Text splitText(in unsigned long offset)
237  raises(DOMException);
238  };
239 
240  interface Comment : CharacterData {
241  };
242 #pragma terminal-interface
243 
244  interface CDATASection : Text {
245  };
246 #pragma terminal-interface
247 
248  interface DocumentType : Node {
249  readonly attribute DOMString name;
250  readonly attribute NamedNodeMap entities;
251  readonly attribute NamedNodeMap notations;
252  // Introduced in DOM Level 2:
253  readonly attribute DOMString publicId;
254  // Introduced in DOM Level 2:
255  readonly attribute DOMString systemId;
256  // Introduced in DOM Level 2:
257  readonly attribute DOMString internalSubset;
258  };
259 #pragma terminal-interface
260 
261  interface Notation : Node {
262  readonly attribute DOMString publicId;
263  readonly attribute DOMString systemId;
264  };
265 #pragma terminal-interface
266 
267  interface Entity : Node {
268  readonly attribute DOMString publicId;
269  readonly attribute DOMString systemId;
270  readonly attribute DOMString notationName;
271  };
272 #pragma terminal-interface
273 
274  interface EntityReference : Node {
275  };
276 #pragma terminal-interface
277 
279  readonly attribute DOMString target;
280  attribute DOMString data;
281  // raises(DOMException) on setting
282  };
283 #pragma terminal-interface
284 
285  interface DocumentFragment : Node {
286  };
287 #pragma terminal-interface
288 
289  interface Document : Node {
290  readonly attribute DocumentType doctype;
291  readonly attribute DOMImplementation implementation;
292  readonly attribute Element documentElement;
293  Element createElement(in DOMString tagName)
294  raises(DOMException);
295  DocumentFragment createDocumentFragment();
296  Text createTextNode(in DOMString data);
297  Comment createComment(in DOMString data);
298  CDATASection createCDATASection(in DOMString data)
299  raises(DOMException);
300  ProcessingInstruction createProcessingInstruction(in DOMString target,
301  in DOMString data)
302  raises(DOMException);
303  Attr createAttribute(in DOMString name)
304  raises(DOMException);
305  EntityReference createEntityReference(in DOMString name)
306  raises(DOMException);
307  NodeList getElementsByTagName(in DOMString tagname);
308  // Introduced in DOM Level 2:
309  Node importNode(in Node importedNode,
310  in boolean deep)
311  raises(DOMException);
312  // Introduced in DOM Level 2:
313  Element createElementNS(in DOMString namespaceURI,
314  in DOMString qualifiedName)
315  raises(DOMException);
316  // Introduced in DOM Level 2:
317  Attr createAttributeNS(in DOMString namespaceURI,
318  in DOMString qualifiedName)
319  raises(DOMException);
320  // Introduced in DOM Level 2:
321  NodeList getElementsByTagNameNS(in DOMString namespaceURI,
322  in DOMString localName);
323  // Introduced in DOM Level 2:
324  Element getElementById(in DOMString elementId);
325  };
326 };
327 
328 #endif // _DOM_IDL_