|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 #ifndef DOMXPathExpression_HEADER_GUARD_ |
|
18 #define DOMXPathExpression_HEADER_GUARD_ |
|
19 |
|
20 /* |
|
21 * Licensed to the Apache Software Foundation (ASF) under one or more |
|
22 * contributor license agreements. See the NOTICE file distributed with |
|
23 * this work for additional information regarding copyright ownership. |
|
24 * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
25 * (the "License"); you may not use this file except in compliance with |
|
26 * the License. You may obtain a copy of the License at |
|
27 * |
|
28 * http://www.apache.org/licenses/LICENSE-2.0 |
|
29 * |
|
30 * Unless required by applicable law or agreed to in writing, software |
|
31 * distributed under the License is distributed on an "AS IS" BASIS, |
|
32 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
33 * See the License for the specific language governing permissions and |
|
34 * limitations under the License. |
|
35 */ |
|
36 |
|
37 #include <xercesc/util/XercesDefs.hpp> |
|
38 |
|
39 XERCES_CPP_NAMESPACE_BEGIN |
|
40 |
|
41 class DOMNode; |
|
42 /** |
|
43 * The <code>DOMXPathExpression</code> interface represents a parsed and resolved XPath expression. |
|
44 * @since DOM Level 3 |
|
45 */ |
|
46 class CDOM_EXPORT DOMXPathExpression |
|
47 { |
|
48 |
|
49 protected: |
|
50 // ----------------------------------------------------------------------- |
|
51 // Hidden constructors |
|
52 // ----------------------------------------------------------------------- |
|
53 /** @name Hidden constructors */ |
|
54 //@{ |
|
55 DOMXPathExpression() {}; |
|
56 //@} |
|
57 |
|
58 private: |
|
59 // ----------------------------------------------------------------------- |
|
60 // Unimplemented constructors and operators |
|
61 // ----------------------------------------------------------------------- |
|
62 /** @name Unimplemented constructors and operators */ |
|
63 //@{ |
|
64 DOMXPathExpression(const DOMXPathExpression &); |
|
65 DOMXPathExpression& operator = (const DOMXPathExpression&); |
|
66 //@} |
|
67 |
|
68 public: |
|
69 // ----------------------------------------------------------------------- |
|
70 // All constructors are hidden, just the destructor is available |
|
71 // ----------------------------------------------------------------------- |
|
72 /** @name Destructor */ |
|
73 //@{ |
|
74 /** |
|
75 * Destructor |
|
76 * |
|
77 */ |
|
78 virtual ~DOMXPathExpression() {}; |
|
79 //@} |
|
80 |
|
81 // ----------------------------------------------------------------------- |
|
82 // Virtual DOMDocument interface |
|
83 // ----------------------------------------------------------------------- |
|
84 /** @name Functions introduced in DOM Level 3 */ |
|
85 //@{ |
|
86 |
|
87 /** |
|
88 * Evaluates this XPath expression and returns a result. |
|
89 * @param contextNode of type <code>DOMNode</code> The context is context |
|
90 * node for the evaluation of this XPath expression. |
|
91 * If the XPathEvaluator was obtained by casting the Document then this must |
|
92 * be owned by the same document and must be a <code>DOMDocument</code>, <code>DOMElement</code>, |
|
93 * <code>DOMAttribute</code>, <code>DOMText</code>, <code>DOMCDATASection</code>, |
|
94 * <code>DOMComment</code>, <code>DOMProcessingInstruction</code>, or |
|
95 * <code>XPathNamespace</code>. If the context node is a <code>DOMText</code> or a |
|
96 * <code>DOMCDATASection</code>, then the context is interpreted as the whole logical |
|
97 * text node as seen by XPath, unless the node is empty in which case it may not |
|
98 * serve as the XPath context. |
|
99 * @param type of type unsigned short If a specific type is specified, then the result |
|
100 * will be coerced to return the specified type relying on XPath conversions and fail |
|
101 * if the desired coercion is not possible. This must be one of the type codes of <code>XPathResult</code>. |
|
102 * @param result of type void* The result specifies a specific result object which |
|
103 * may be reused and returned by this method. If this is specified as nullor the |
|
104 * implementation does not reuse the specified result, a new result object will be constructed |
|
105 * and returned. |
|
106 * For XPath 1.0 results, this object will be of type <code>XPathResult</code>. |
|
107 * @return void* The result of the evaluation of the XPath expression. |
|
108 * For XPath 1.0 results, this object will be of type <code>XPathResult</code>. |
|
109 * @exception <code>XPathException</code> |
|
110 * TYPE_ERR: Raised if the result cannot be converted to return the specified type. |
|
111 * @exception <code>DOMException</code> |
|
112 * WRONG_DOCUMENT_ERR: The <code>DOMNode</code> is from a document that is not supported by |
|
113 * the <code>XPathEvaluator</code> that created this <code>DOMXPathExpression</code>. |
|
114 * NOT_SUPPORTED_ERR: The Node is not a type permitted as an XPath context node or the |
|
115 * request type is not permitted by this <code>DOMXPathExpression</code>. |
|
116 */ |
|
117 |
|
118 virtual void* evaluate(DOMNode *contextNode, unsigned short type, void* result) const = 0; |
|
119 //@} |
|
120 }; |
|
121 |
|
122 XERCES_CPP_NAMESPACE_END |
|
123 |
|
124 #endif |