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/NOTE-DOM-Level-3-XPath-20040226/xpath.idl
15 #ifndef _XPATH_IDL_
16 #define _XPATH_IDL_
18 #include "dom.idl"
20 #pragma prefix "dom.w3c.org"
21 module xpath
22 {
24 typedef dom::DOMString DOMString;
25 typedef dom::Node Node;
26 typedef dom::DOMObject DOMObject;
27 typedef dom::Element Element;
29 interface XPathNSResolver;
30 interface XPathExpression;
32 exception XPathException {
33 unsigned short code;
34 };
35 // XPathExceptionCode
36 const unsigned short INVALID_EXPRESSION_ERR = 51;
37 const unsigned short TYPE_ERR = 52;
40 interface XPathEvaluator {
41 XPathExpression createExpression(in DOMString expression,
42 in XPathNSResolver resolver)
43 raises(XPathException,
44 dom::DOMException);
45 XPathNSResolver createNSResolver(in Node nodeResolver);
46 DOMObject evaluate(in DOMString expression,
47 in Node contextNode,
48 in XPathNSResolver resolver,
49 in unsigned short type,
50 in DOMObject result)
51 raises(XPathException,
52 dom::DOMException);
53 };
55 interface XPathExpression {
56 DOMObject evaluate(in Node contextNode,
57 in unsigned short type,
58 in DOMObject result)
59 raises(XPathException,
60 dom::DOMException);
61 };
63 interface XPathNSResolver {
64 DOMString lookupNamespaceURI(in DOMString prefix);
65 };
67 interface XPathResult {
69 // XPathResultType
70 const unsigned short ANY_TYPE = 0;
71 const unsigned short NUMBER_TYPE = 1;
72 const unsigned short STRING_TYPE = 2;
73 const unsigned short BOOLEAN_TYPE = 3;
74 const unsigned short UNORDERED_NODE_ITERATOR_TYPE = 4;
75 const unsigned short ORDERED_NODE_ITERATOR_TYPE = 5;
76 const unsigned short UNORDERED_NODE_SNAPSHOT_TYPE = 6;
77 const unsigned short ORDERED_NODE_SNAPSHOT_TYPE = 7;
78 const unsigned short ANY_UNORDERED_NODE_TYPE = 8;
79 const unsigned short FIRST_ORDERED_NODE_TYPE = 9;
81 readonly attribute unsigned short resultType;
82 readonly attribute double numberValue;
83 // raises(XPathException) on retrieval
85 readonly attribute DOMString stringValue;
86 // raises(XPathException) on retrieval
88 readonly attribute boolean booleanValue;
89 // raises(XPathException) on retrieval
91 readonly attribute Node singleNodeValue;
92 // raises(XPathException) on retrieval
94 readonly attribute boolean invalidIteratorState;
95 readonly attribute unsigned long snapshotLength;
96 // raises(XPathException) on retrieval
98 Node iterateNext()
99 raises(XPathException,
100 dom::DOMException);
101 Node snapshotItem(in unsigned long index)
102 raises(XPathException);
103 };
105 interface XPathNamespace : Node {
107 // XPathNodeType
108 const unsigned short XPATH_NAMESPACE_NODE = 13;
110 readonly attribute Element ownerElement;
111 };
112 };
114 #endif // _XPATH_IDL_