1 /*
2 * Copyright (c) 2004 World Wide Web Consortium,
3 *
4 * (Massachusetts Institute of Technology, European Research Consortium for
5 * Informatics and Mathematics, Keio University). All Rights Reserved. This
6 * work is distributed under the W3C(r) Software License [1] in the hope that
7 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
8 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 *
10 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
11 */
13 // File: http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/dom.idl
15 #ifndef _DOM_IDL_
16 #define _DOM_IDL_
18 #pragma prefix "w3c.org"
19 module dom
20 {
22 valuetype DOMString sequence<unsigned short>;
24 typedef unsigned long long DOMTimeStamp;
26 typedef any DOMUserData;
28 typedef Object DOMObject;
30 interface DOMImplementation;
31 interface DocumentType;
32 interface Document;
33 interface NodeList;
34 interface NamedNodeMap;
35 interface UserDataHandler;
36 interface Element;
37 interface TypeInfo;
38 interface DOMLocator;
40 exception DOMException {
41 unsigned short code;
42 };
43 // ExceptionCode
44 const unsigned short INDEX_SIZE_ERR = 1;
45 const unsigned short DOMSTRING_SIZE_ERR = 2;
46 const unsigned short HIERARCHY_REQUEST_ERR = 3;
47 const unsigned short WRONG_DOCUMENT_ERR = 4;
48 const unsigned short INVALID_CHARACTER_ERR = 5;
49 const unsigned short NO_DATA_ALLOWED_ERR = 6;
50 const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
51 const unsigned short NOT_FOUND_ERR = 8;
52 const unsigned short NOT_SUPPORTED_ERR = 9;
53 const unsigned short INUSE_ATTRIBUTE_ERR = 10;
54 // Introduced in DOM Level 2:
55 const unsigned short INVALID_STATE_ERR = 11;
56 // Introduced in DOM Level 2:
57 const unsigned short SYNTAX_ERR = 12;
58 // Introduced in DOM Level 2:
59 const unsigned short INVALID_MODIFICATION_ERR = 13;
60 // Introduced in DOM Level 2:
61 const unsigned short NAMESPACE_ERR = 14;
62 // Introduced in DOM Level 2:
63 const unsigned short INVALID_ACCESS_ERR = 15;
64 // Introduced in DOM Level 3:
65 const unsigned short VALIDATION_ERR = 16;
66 // Introduced in DOM Level 3:
67 const unsigned short TYPE_MISMATCH_ERR = 17;
70 // Introduced in DOM Level 3:
71 interface DOMStringList {
72 DOMString item(in unsigned long index);
73 readonly attribute unsigned long length;
74 boolean contains(in DOMString str);
75 };
77 // Introduced in DOM Level 3:
78 interface NameList {
79 DOMString getName(in unsigned long index);
80 DOMString getNamespaceURI(in unsigned long index);
81 readonly attribute unsigned long length;
82 boolean contains(in DOMString str);
83 boolean containsNS(in DOMString namespaceURI,
84 in DOMString name);
85 };
87 // Introduced in DOM Level 3:
88 interface DOMImplementationList {
89 DOMImplementation item(in unsigned long index);
90 readonly attribute unsigned long length;
91 };
93 // Introduced in DOM Level 3:
94 interface DOMImplementationSource {
95 DOMImplementation getDOMImplementation(in DOMString features);
96 DOMImplementationList getDOMImplementationList(in DOMString features);
97 };
99 interface DOMImplementation {
100 boolean hasFeature(in DOMString feature,
101 in DOMString version);
102 // Introduced in DOM Level 2:
103 DocumentType createDocumentType(in DOMString qualifiedName,
104 in DOMString publicId,
105 in DOMString systemId)
106 raises(DOMException);
107 // Introduced in DOM Level 2:
108 Document createDocument(in DOMString namespaceURI,
109 in DOMString qualifiedName,
110 in DocumentType doctype)
111 raises(DOMException);
112 // Introduced in DOM Level 3:
113 DOMObject getFeature(in DOMString feature,
114 in DOMString version);
115 };
117 interface Node {
119 // NodeType
120 const unsigned short ELEMENT_NODE = 1;
121 const unsigned short ATTRIBUTE_NODE = 2;
122 const unsigned short TEXT_NODE = 3;
123 const unsigned short CDATA_SECTION_NODE = 4;
124 const unsigned short ENTITY_REFERENCE_NODE = 5;
125 const unsigned short ENTITY_NODE = 6;
126 const unsigned short PROCESSING_INSTRUCTION_NODE = 7;
127 const unsigned short COMMENT_NODE = 8;
128 const unsigned short DOCUMENT_NODE = 9;
129 const unsigned short DOCUMENT_TYPE_NODE = 10;
130 const unsigned short DOCUMENT_FRAGMENT_NODE = 11;
131 const unsigned short NOTATION_NODE = 12;
133 readonly attribute DOMString nodeName;
134 attribute DOMString nodeValue;
135 // raises(DOMException) on setting
136 // raises(DOMException) on retrieval
138 readonly attribute unsigned short nodeType;
139 readonly attribute Node parentNode;
140 readonly attribute NodeList childNodes;
141 readonly attribute Node firstChild;
142 readonly attribute Node lastChild;
143 readonly attribute Node previousSibling;
144 readonly attribute Node nextSibling;
145 readonly attribute NamedNodeMap attributes;
146 // Modified in DOM Level 2:
147 readonly attribute Document ownerDocument;
148 // Modified in DOM Level 3:
149 Node insertBefore(in Node newChild,
150 in Node refChild)
151 raises(DOMException);
152 // Modified in DOM Level 3:
153 Node replaceChild(in Node newChild,
154 in Node oldChild)
155 raises(DOMException);
156 // Modified in DOM Level 3:
157 Node removeChild(in Node oldChild)
158 raises(DOMException);
159 // Modified in DOM Level 3:
160 Node appendChild(in Node newChild)
161 raises(DOMException);
162 boolean hasChildNodes();
163 Node cloneNode(in boolean deep);
164 // Modified in DOM Level 3:
165 void normalize();
166 // Introduced in DOM Level 2:
167 boolean isSupported(in DOMString feature,
168 in DOMString version);
169 // Introduced in DOM Level 2:
170 readonly attribute DOMString namespaceURI;
171 // Introduced in DOM Level 2:
172 attribute DOMString prefix;
173 // raises(DOMException) on setting
175 // Introduced in DOM Level 2:
176 readonly attribute DOMString localName;
177 // Introduced in DOM Level 2:
178 boolean hasAttributes();
179 // Introduced in DOM Level 3:
180 readonly attribute DOMString baseURI;
182 // DocumentPosition
183 const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01;
184 const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02;
185 const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04;
186 const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08;
187 const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10;
188 const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
190 // Introduced in DOM Level 3:
191 unsigned short compareDocumentPosition(in Node other)
192 raises(DOMException);
193 // Introduced in DOM Level 3:
194 attribute DOMString textContent;
195 // raises(DOMException) on setting
196 // raises(DOMException) on retrieval
198 // Introduced in DOM Level 3:
199 boolean isSameNode(in Node other);
200 // Introduced in DOM Level 3:
201 DOMString lookupPrefix(in DOMString namespaceURI);
202 // Introduced in DOM Level 3:
203 boolean isDefaultNamespace(in DOMString namespaceURI);
204 // Introduced in DOM Level 3:
205 DOMString lookupNamespaceURI(in DOMString prefix);
206 // Introduced in DOM Level 3:
207 boolean isEqualNode(in Node arg);
208 // Introduced in DOM Level 3:
209 DOMObject getFeature(in DOMString feature,
210 in DOMString version);
211 // Introduced in DOM Level 3:
212 DOMUserData setUserData(in DOMString key,
213 in DOMUserData data,
214 in UserDataHandler handler);
215 // Introduced in DOM Level 3:
216 DOMUserData getUserData(in DOMString key);
217 };
219 interface NodeList {
220 Node item(in unsigned long index);
221 readonly attribute unsigned long length;
222 };
224 interface NamedNodeMap {
225 Node getNamedItem(in DOMString name);
226 Node setNamedItem(in Node arg)
227 raises(DOMException);
228 Node removeNamedItem(in DOMString name)
229 raises(DOMException);
230 Node item(in unsigned long index);
231 readonly attribute unsigned long length;
232 // Introduced in DOM Level 2:
233 Node getNamedItemNS(in DOMString namespaceURI,
234 in DOMString localName)
235 raises(DOMException);
236 // Introduced in DOM Level 2:
237 Node setNamedItemNS(in Node arg)
238 raises(DOMException);
239 // Introduced in DOM Level 2:
240 Node removeNamedItemNS(in DOMString namespaceURI,
241 in DOMString localName)
242 raises(DOMException);
243 };
245 interface CharacterData : Node {
246 attribute DOMString data;
247 // raises(DOMException) on setting
248 // raises(DOMException) on retrieval
250 readonly attribute unsigned long length;
251 DOMString substringData(in unsigned long offset,
252 in unsigned long count)
253 raises(DOMException);
254 void appendData(in DOMString arg)
255 raises(DOMException);
256 void insertData(in unsigned long offset,
257 in DOMString arg)
258 raises(DOMException);
259 void deleteData(in unsigned long offset,
260 in unsigned long count)
261 raises(DOMException);
262 void replaceData(in unsigned long offset,
263 in unsigned long count,
264 in DOMString arg)
265 raises(DOMException);
266 };
268 interface Attr : Node {
269 readonly attribute DOMString name;
270 readonly attribute boolean specified;
271 attribute DOMString value;
272 // raises(DOMException) on setting
274 // Introduced in DOM Level 2:
275 readonly attribute Element ownerElement;
276 // Introduced in DOM Level 3:
277 readonly attribute TypeInfo schemaTypeInfo;
278 // Introduced in DOM Level 3:
279 readonly attribute boolean isId;
280 };
282 interface Element : Node {
283 readonly attribute DOMString tagName;
284 DOMString getAttribute(in DOMString name);
285 void setAttribute(in DOMString name,
286 in DOMString value)
287 raises(DOMException);
288 void removeAttribute(in DOMString name)
289 raises(DOMException);
290 Attr getAttributeNode(in DOMString name);
291 Attr setAttributeNode(in Attr newAttr)
292 raises(DOMException);
293 Attr removeAttributeNode(in Attr oldAttr)
294 raises(DOMException);
295 NodeList getElementsByTagName(in DOMString name);
296 // Introduced in DOM Level 2:
297 DOMString getAttributeNS(in DOMString namespaceURI,
298 in DOMString localName)
299 raises(DOMException);
300 // Introduced in DOM Level 2:
301 void setAttributeNS(in DOMString namespaceURI,
302 in DOMString qualifiedName,
303 in DOMString value)
304 raises(DOMException);
305 // Introduced in DOM Level 2:
306 void removeAttributeNS(in DOMString namespaceURI,
307 in DOMString localName)
308 raises(DOMException);
309 // Introduced in DOM Level 2:
310 Attr getAttributeNodeNS(in DOMString namespaceURI,
311 in DOMString localName)
312 raises(DOMException);
313 // Introduced in DOM Level 2:
314 Attr setAttributeNodeNS(in Attr newAttr)
315 raises(DOMException);
316 // Introduced in DOM Level 2:
317 NodeList getElementsByTagNameNS(in DOMString namespaceURI,
318 in DOMString localName)
319 raises(DOMException);
320 // Introduced in DOM Level 2:
321 boolean hasAttribute(in DOMString name);
322 // Introduced in DOM Level 2:
323 boolean hasAttributeNS(in DOMString namespaceURI,
324 in DOMString localName)
325 raises(DOMException);
326 // Introduced in DOM Level 3:
327 readonly attribute TypeInfo schemaTypeInfo;
328 // Introduced in DOM Level 3:
329 void setIdAttribute(in DOMString name,
330 in boolean isId)
331 raises(DOMException);
332 // Introduced in DOM Level 3:
333 void setIdAttributeNS(in DOMString namespaceURI,
334 in DOMString localName,
335 in boolean isId)
336 raises(DOMException);
337 // Introduced in DOM Level 3:
338 void setIdAttributeNode(in Attr idAttr,
339 in boolean isId)
340 raises(DOMException);
341 };
343 interface Text : CharacterData {
344 Text splitText(in unsigned long offset)
345 raises(DOMException);
346 // Introduced in DOM Level 3:
347 readonly attribute boolean isElementContentWhitespace;
348 // Introduced in DOM Level 3:
349 readonly attribute DOMString wholeText;
350 // Introduced in DOM Level 3:
351 Text replaceWholeText(in DOMString content)
352 raises(DOMException);
353 };
355 interface Comment : CharacterData {
356 };
358 // Introduced in DOM Level 3:
359 interface TypeInfo {
360 readonly attribute DOMString typeName;
361 readonly attribute DOMString typeNamespace;
363 // DerivationMethods
364 const unsigned long DERIVATION_RESTRICTION = 0x00000001;
365 const unsigned long DERIVATION_EXTENSION = 0x00000002;
366 const unsigned long DERIVATION_UNION = 0x00000004;
367 const unsigned long DERIVATION_LIST = 0x00000008;
369 boolean isDerivedFrom(in DOMString typeNamespaceArg,
370 in DOMString typeNameArg,
371 in unsigned long derivationMethod);
372 };
374 // Introduced in DOM Level 3:
375 interface UserDataHandler {
377 // OperationType
378 const unsigned short NODE_CLONED = 1;
379 const unsigned short NODE_IMPORTED = 2;
380 const unsigned short NODE_DELETED = 3;
381 const unsigned short NODE_RENAMED = 4;
382 const unsigned short NODE_ADOPTED = 5;
384 void handle(in unsigned short operation,
385 in DOMString key,
386 in DOMUserData data,
387 in Node src,
388 in Node dst);
389 };
391 // Introduced in DOM Level 3:
392 interface DOMError {
394 // ErrorSeverity
395 const unsigned short SEVERITY_WARNING = 1;
396 const unsigned short SEVERITY_ERROR = 2;
397 const unsigned short SEVERITY_FATAL_ERROR = 3;
399 readonly attribute unsigned short severity;
400 readonly attribute DOMString message;
401 readonly attribute DOMString type;
402 readonly attribute DOMObject relatedException;
403 readonly attribute DOMObject relatedData;
404 readonly attribute DOMLocator location;
405 };
407 // Introduced in DOM Level 3:
408 interface DOMErrorHandler {
409 boolean handleError(in DOMError error);
410 };
412 // Introduced in DOM Level 3:
413 interface DOMLocator {
414 readonly attribute long lineNumber;
415 readonly attribute long columnNumber;
416 readonly attribute long byteOffset;
417 readonly attribute long utf16Offset;
418 readonly attribute Node relatedNode;
419 readonly attribute DOMString uri;
420 };
422 // Introduced in DOM Level 3:
423 interface DOMConfiguration {
424 void setParameter(in DOMString name,
425 in DOMUserData value)
426 raises(DOMException);
427 DOMUserData getParameter(in DOMString name)
428 raises(DOMException);
429 boolean canSetParameter(in DOMString name,
430 in DOMUserData value);
431 readonly attribute DOMStringList parameterNames;
432 };
434 interface CDATASection : Text {
435 };
437 interface DocumentType : Node {
438 readonly attribute DOMString name;
439 readonly attribute NamedNodeMap entities;
440 readonly attribute NamedNodeMap notations;
441 // Introduced in DOM Level 2:
442 readonly attribute DOMString publicId;
443 // Introduced in DOM Level 2:
444 readonly attribute DOMString systemId;
445 // Introduced in DOM Level 2:
446 readonly attribute DOMString internalSubset;
447 };
449 interface Notation : Node {
450 readonly attribute DOMString publicId;
451 readonly attribute DOMString systemId;
452 };
454 interface Entity : Node {
455 readonly attribute DOMString publicId;
456 readonly attribute DOMString systemId;
457 readonly attribute DOMString notationName;
458 // Introduced in DOM Level 3:
459 readonly attribute DOMString inputEncoding;
460 // Introduced in DOM Level 3:
461 readonly attribute DOMString xmlEncoding;
462 // Introduced in DOM Level 3:
463 readonly attribute DOMString xmlVersion;
464 };
466 interface EntityReference : Node {
467 };
469 interface ProcessingInstruction : Node {
470 readonly attribute DOMString target;
471 attribute DOMString data;
472 // raises(DOMException) on setting
474 };
476 interface DocumentFragment : Node {
477 };
479 interface Document : Node {
480 // Modified in DOM Level 3:
481 readonly attribute DocumentType doctype;
482 readonly attribute DOMImplementation implementation;
483 readonly attribute Element documentElement;
484 Element createElement(in DOMString tagName)
485 raises(DOMException);
486 DocumentFragment createDocumentFragment();
487 Text createTextNode(in DOMString data);
488 Comment createComment(in DOMString data);
489 CDATASection createCDATASection(in DOMString data)
490 raises(DOMException);
491 ProcessingInstruction createProcessingInstruction(in DOMString target,
492 in DOMString data)
493 raises(DOMException);
494 Attr createAttribute(in DOMString name)
495 raises(DOMException);
496 EntityReference createEntityReference(in DOMString name)
497 raises(DOMException);
498 NodeList getElementsByTagName(in DOMString tagname);
499 // Introduced in DOM Level 2:
500 Node importNode(in Node importedNode,
501 in boolean deep)
502 raises(DOMException);
503 // Introduced in DOM Level 2:
504 Element createElementNS(in DOMString namespaceURI,
505 in DOMString qualifiedName)
506 raises(DOMException);
507 // Introduced in DOM Level 2:
508 Attr createAttributeNS(in DOMString namespaceURI,
509 in DOMString qualifiedName)
510 raises(DOMException);
511 // Introduced in DOM Level 2:
512 NodeList getElementsByTagNameNS(in DOMString namespaceURI,
513 in DOMString localName);
514 // Introduced in DOM Level 2:
515 Element getElementById(in DOMString elementId);
516 // Introduced in DOM Level 3:
517 readonly attribute DOMString inputEncoding;
518 // Introduced in DOM Level 3:
519 readonly attribute DOMString xmlEncoding;
520 // Introduced in DOM Level 3:
521 attribute boolean xmlStandalone;
522 // raises(DOMException) on setting
524 // Introduced in DOM Level 3:
525 attribute DOMString xmlVersion;
526 // raises(DOMException) on setting
528 // Introduced in DOM Level 3:
529 attribute boolean strictErrorChecking;
530 // Introduced in DOM Level 3:
531 attribute DOMString documentURI;
532 // Introduced in DOM Level 3:
533 Node adoptNode(in Node source)
534 raises(DOMException);
535 // Introduced in DOM Level 3:
536 readonly attribute DOMConfiguration domConfig;
537 // Introduced in DOM Level 3:
538 void normalizeDocument();
539 // Introduced in DOM Level 3:
540 Node renameNode(in Node n,
541 in DOMString namespaceURI,
542 in DOMString qualifiedName)
543 raises(DOMException);
544 };
545 };
547 #endif // _DOM_IDL_