summaryrefslogtreecommitdiffstats
path: root/src/dom/work/traversal.idl
blob: 660f4577d4ec0fdefee3339ed9063be201eecb3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
 * Copyright (c) 2000 World Wide Web Consortium,
 * (Massachusetts Institute of Technology, Institut National de
 * Recherche en Informatique et en Automatique, Keio University). All
 * Rights Reserved. This program is distributed under the W3C's Software
 * Intellectual Property License. This program is distributed in the
 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE.
 * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
 */

// File: http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/traversal.idl

#ifndef _TRAVERSAL_IDL_
#define _TRAVERSAL_IDL_

#include "dom.idl"

#pragma prefix "dom.w3c.org"
module traversal
{

  typedef dom::Node Node;

  interface NodeFilter;

  // Introduced in DOM Level 2:
  interface NodeIterator {
    readonly attribute Node             root;
    readonly attribute unsigned long    whatToShow;
    readonly attribute NodeFilter       filter;
    readonly attribute boolean          expandEntityReferences;
    Node               nextNode()
                                        raises(dom::DOMException);
    Node               previousNode()
                                        raises(dom::DOMException);
    void               detach();
  };

  // Introduced in DOM Level 2:
  interface NodeFilter {

    // Constants returned by acceptNode
    const short               FILTER_ACCEPT                  = 1;
    const short               FILTER_REJECT                  = 2;
    const short               FILTER_SKIP                    = 3;


    // Constants for whatToShow
    const unsigned long       SHOW_ALL                       = 0xFFFFFFFF;
    const unsigned long       SHOW_ELEMENT                   = 0x00000001;
    const unsigned long       SHOW_ATTRIBUTE                 = 0x00000002;
    const unsigned long       SHOW_TEXT                      = 0x00000004;
    const unsigned long       SHOW_CDATA_SECTION             = 0x00000008;
    const unsigned long       SHOW_ENTITY_REFERENCE          = 0x00000010;
    const unsigned long       SHOW_ENTITY                    = 0x00000020;
    const unsigned long       SHOW_PROCESSING_INSTRUCTION    = 0x00000040;
    const unsigned long       SHOW_COMMENT                   = 0x00000080;
    const unsigned long       SHOW_DOCUMENT                  = 0x00000100;
    const unsigned long       SHOW_DOCUMENT_TYPE             = 0x00000200;
    const unsigned long       SHOW_DOCUMENT_FRAGMENT         = 0x00000400;
    const unsigned long       SHOW_NOTATION                  = 0x00000800;

    short              acceptNode(in Node n);
  };

  // Introduced in DOM Level 2:
  interface TreeWalker {
    readonly attribute Node             root;
    readonly attribute unsigned long    whatToShow;
    readonly attribute NodeFilter       filter;
    readonly attribute boolean          expandEntityReferences;
             attribute Node             currentNode;
                                        // raises(dom::DOMException) on setting

    Node               parentNode();
    Node               firstChild();
    Node               lastChild();
    Node               previousSibling();
    Node               nextSibling();
    Node               previousNode();
    Node               nextNode();
  };

  // Introduced in DOM Level 2:
  interface DocumentTraversal {
    NodeIterator       createNodeIterator(in Node root, 
                                          in unsigned long whatToShow, 
                                          in NodeFilter filter, 
                                          in boolean entityReferenceExpansion)
                                        raises(dom::DOMException);
    TreeWalker         createTreeWalker(in Node root, 
                                        in unsigned long whatToShow, 
                                        in NodeFilter filter, 
                                        in boolean entityReferenceExpansion)
                                        raises(dom::DOMException);
  };
};

#endif // _TRAVERSAL_IDL_