|
|
|||
Warning, file /include/xercesc/dom/DOMXPathResult.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * Licensed to the Apache Software Foundation (ASF) under one or more 0003 * contributor license agreements. See the NOTICE file distributed with 0004 * this work for additional information regarding copyright ownership. 0005 * The ASF licenses this file to You under the Apache License, Version 2.0 0006 * (the "License"); you may not use this file except in compliance with 0007 * the License. You may obtain a copy of the License at 0008 * 0009 * http://www.apache.org/licenses/LICENSE-2.0 0010 * 0011 * Unless required by applicable law or agreed to in writing, software 0012 * distributed under the License is distributed on an "AS IS" BASIS, 0013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0014 * See the License for the specific language governing permissions and 0015 * limitations under the License. 0016 */ 0017 0018 /* 0019 * $Id$ 0020 */ 0021 0022 #if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHRESULT_HPP) 0023 #define XERCESC_INCLUDE_GUARD_DOMXPATHRESULT_HPP 0024 0025 #include <xercesc/util/XercesDefs.hpp> 0026 0027 XERCES_CPP_NAMESPACE_BEGIN 0028 0029 class DOMXPathNSResolver; 0030 class DOMXPathExpression; 0031 class DOMTypeInfo; 0032 class DOMNode; 0033 0034 /** 0035 * The <code>DOMXPathResult</code> interface represents the result of the 0036 * evaluation of an XPath 1.0 or XPath 2.0 expression within the context 0037 * of a particular node. Since evaluation of an XPath expression can result 0038 * in various result types, this object makes it possible to discover and 0039 * manipulate the type and value of the result. 0040 * 0041 * Note that some function signatures were changed compared to the 0042 * DOM Level 3 in order to accommodate XPath 2.0. 0043 * 0044 * @since DOM Level 3 0045 */ 0046 class CDOM_EXPORT DOMXPathResult 0047 { 0048 0049 protected: 0050 // ----------------------------------------------------------------------- 0051 // Hidden constructors 0052 // ----------------------------------------------------------------------- 0053 /** @name Hidden constructors */ 0054 //@{ 0055 DOMXPathResult() {}; 0056 //@} 0057 0058 private: 0059 // ----------------------------------------------------------------------- 0060 // Unimplemented constructors and operators 0061 // ----------------------------------------------------------------------- 0062 /** @name Unimplemented constructors and operators */ 0063 //@{ 0064 DOMXPathResult(const DOMXPathResult &); 0065 DOMXPathResult& operator = (const DOMXPathResult&); 0066 //@} 0067 0068 public: 0069 // ----------------------------------------------------------------------- 0070 // All constructors are hidden, just the destructor is available 0071 // ----------------------------------------------------------------------- 0072 /** @name Destructor */ 0073 //@{ 0074 /** 0075 * Destructor 0076 * 0077 */ 0078 virtual ~DOMXPathResult() {}; 0079 //@} 0080 0081 // ----------------------------------------------------------------------- 0082 // Class Types 0083 // ----------------------------------------------------------------------- 0084 /** @name Public Constants */ 0085 //@{ 0086 /** 0087 * <p>ANY_TYPE 0088 * <br>[XPath 1.0] This code does not represent a specific type. An evaluation of an XPath 0089 * expression will never produce this type. If this type is requested, then 0090 * the evaluation returns whatever type naturally results from evaluation 0091 * of the expression. 0092 * If the natural result is a node set when ANY_TYPE was requested, then 0093 * UNORDERED_NODE_ITERATOR_TYPE is always the resulting type. Any other 0094 * representation of a node set must be explicitly requested. 0095 * <p>ANY_UNORDERED_NODE_TYPE 0096 * <br>[XPath 1.0] The result is a node set as defined by XPath 1.0 and will be accessed 0097 * as a single node, which may be null if the node set is empty. Document 0098 * modification does not invalidate the node, but may mean that the result 0099 * node no longer corresponds to the current document. This is a convenience 0100 * that permits optimization since the implementation can stop once any node 0101 * in the resulting set has been found. 0102 * If there is more than one node in the actual result, the single node 0103 * returned might not be the first in document order. 0104 * <p>BOOLEAN_TYPE 0105 * <br>[XPath 1.0] The result is a boolean as defined by XPath 1.0. Document modification 0106 * does not invalidate the boolean, but may mean that reevaluation would not 0107 * yield the same boolean. 0108 * <p>FIRST_ORDERED_NODE_TYPE 0109 * <br>[XPath 1.0] The result is a node set as defined by XPath 1.0 and will be accessed 0110 * as a single node, which may be null if the node set is empty. Document 0111 * modification does not invalidate the node, but may mean that the result 0112 * node no longer corresponds to the current document. This is a convenience 0113 * that permits optimization since the implementation can stop once the first 0114 * node in document order of the resulting set has been found. 0115 * If there are more than one node in the actual result, the single node 0116 * returned will be the first in document order. 0117 * <p>NUMBER_TYPE 0118 * <br>[XPath 1.0] The result is a number as defined by XPath 1.0. Document modification does 0119 * not invalidate the number, but may mean that reevaluation would not yield the 0120 * same number. 0121 * <p>ORDERED_NODE_ITERATOR_TYPE 0122 * <br>[XPath 1.0] The result is a node set as defined by XPath 1.0 that will be accessed 0123 * iteratively, which will produce document-ordered nodes. Document modification 0124 * invalidates the iteration. 0125 * <p>ORDERED_NODE_SNAPSHOT_TYPE 0126 * <br>[XPath 1.0] The result is a node set as defined by XPath 1.0 that will be accessed as a 0127 * snapshot list of nodes that will be in original document order. Document 0128 * modification does not invalidate the snapshot but may mean that reevaluation would 0129 * not yield the same snapshot and nodes in the snapshot may have been altered, moved, 0130 * or removed from the document. 0131 * <p>STRING_TYPE 0132 * <br>[XPath 1.0] The result is a string as defined by XPath 1.0. Document modification does not 0133 * invalidate the string, but may mean that the string no longer corresponds to the 0134 * current document. 0135 * <p>UNORDERED_NODE_ITERATOR_TYPE 0136 * <br>[XPath 1.0] The result is a node set as defined by XPath 1.0 that will be accessed iteratively, 0137 * which may not produce nodes in a particular order. Document modification invalidates the iteration. 0138 * This is the default type returned if the result is a node set and ANY_TYPE is requested. 0139 * <p>UNORDERED_NODE_SNAPSHOT_TYPE 0140 * <br>[XPath 1.0] The result is a node set as defined by XPath 1.0 that will be accessed as a 0141 * snapshot list of nodes that may not be in a particular order. Document modification 0142 * does not invalidate the snapshot but may mean that reevaluation would not yield the same 0143 * snapshot and nodes in the snapshot may have been altered, moved, or removed from the document. 0144 * <p>FIRST_RESULT_TYPE 0145 * <br>[XPath 2.0] The result is a sequence as defined by XPath 2.0 and will be accessed 0146 * as a single current value or there will be no current value if the sequence 0147 * is empty. Document modification does not invalidate the value, but may mean 0148 * that the result no longer corresponds to the current document. This is a 0149 * convenience that permits optimization since the implementation can stop once 0150 * the first item in the resulting sequence has been found. If there is more 0151 * than one item in the actual result, the single item returned might not be 0152 * the first in document order. 0153 * <p>ITERATOR_RESULT_TYPE 0154 * <br>[XPath 2.0] The result is a sequence as defined by XPath 2.0 that will be accessed 0155 * iteratively. Document modification invalidates the iteration. 0156 * <p>SNAPSHOT_RESULT_TYPE 0157 * <br>[XPath 2.0] The result is a sequence as defined by XPath 2.0 that will be accessed 0158 * as a snapshot list of values. Document modification does not invalidate the 0159 * snapshot but may mean that reevaluation would not yield the same snapshot 0160 * and any items in the snapshot may have been altered, moved, or removed from 0161 * the document. 0162 */ 0163 enum ResultType { 0164 /* XPath 1.0 */ 0165 ANY_TYPE = 0, 0166 NUMBER_TYPE = 1, 0167 STRING_TYPE = 2, 0168 BOOLEAN_TYPE = 3, 0169 UNORDERED_NODE_ITERATOR_TYPE = 4, 0170 ORDERED_NODE_ITERATOR_TYPE = 5, 0171 UNORDERED_NODE_SNAPSHOT_TYPE = 6, 0172 ORDERED_NODE_SNAPSHOT_TYPE = 7, 0173 ANY_UNORDERED_NODE_TYPE = 8, 0174 FIRST_ORDERED_NODE_TYPE = 9, 0175 /* XPath 2.0 */ 0176 FIRST_RESULT_TYPE = 100, 0177 ITERATOR_RESULT_TYPE = 101, 0178 SNAPSHOT_RESULT_TYPE = 102 0179 }; 0180 //@} 0181 0182 0183 // ----------------------------------------------------------------------- 0184 // Virtual DOMXPathResult interface 0185 // ----------------------------------------------------------------------- 0186 /** @name Functions introduced in DOM Level 3 */ 0187 //@{ 0188 0189 /** 0190 * Returns the result type of this result 0191 * @return ResultType 0192 * A code representing the type of this result, as defined by the type constants. 0193 */ 0194 virtual ResultType getResultType() const = 0; 0195 0196 /** 0197 * Returns the DOM type info of the current result node or value 0198 * (XPath 2 only). 0199 * @return typeInfo of type TypeInfo, readonly 0200 */ 0201 virtual const DOMTypeInfo *getTypeInfo() const = 0; 0202 0203 /** 0204 * Returns true if the result has a current result and the value is a 0205 * node (XPath 2 only). This function is necessary to distinguish 0206 * between a string value and a node of type string as returned by 0207 * the getTypeInfo() function. 0208 * @return isNode of type boolean, readonly 0209 */ 0210 virtual bool isNode() const = 0; 0211 0212 /** 0213 * Returns the boolean value of this result 0214 * @return booleanValue of type boolean 0215 * The value of this boolean result. 0216 * @exception DOMXPathException 0217 * TYPE_ERR: raised if ResultType is not BOOLEAN_TYPE (XPath 1.0) or 0218 * if current result cannot be properly converted to boolean (XPath 2.0). 0219 * <br> 0220 * NO_RESULT_ERROR: raised if there is no current result in the result object (XPath 2.0). 0221 */ 0222 virtual bool getBooleanValue() const = 0; 0223 0224 /** 0225 * Returns the integer value of this result (XPath 2 only). 0226 * @return integerValue of type int 0227 * The value of this integer result. 0228 * @exception DOMXPathException 0229 * TYPE_ERR: raised if current result cannot be properly converted to 0230 * int (XPath 2.0). 0231 * <br> 0232 * NO_RESULT_ERROR: raised if there is no current result in the result object (XPath 2.0). 0233 */ 0234 virtual int getIntegerValue() const = 0; 0235 0236 /** 0237 * Returns the number value of this result 0238 * @return numberValue 0239 * The value of this number result. If the native double type of the DOM 0240 * binding does not directly support the exact IEEE 754 result of the XPath 0241 * expression, then it is up to the definition of the binding to specify how 0242 * the XPath number is converted to the native binding number. 0243 * @exception DOMXPathException 0244 * TYPE_ERR: raised if ResultType is not NUMBER_TYPE (XPath 1.0) or 0245 * if current result cannot be properly converted to double (XPath 2.0). 0246 * <br> 0247 * NO_RESULT_ERROR: raised if there is no current result in the result object (XPath 2.0). 0248 */ 0249 virtual double getNumberValue() const = 0; 0250 0251 /** 0252 * Returns the string value of this result 0253 * @return stringValue 0254 * The value of this string result. 0255 * @exception DOMXPathException 0256 * TYPE_ERR: raised if ResultType is not STRING_TYPE (XPath 1.0) or 0257 * if current result cannot be properly converted to string (XPath 2.0). 0258 * <br> 0259 * NO_RESULT_ERROR: raised if there is no current result in the result object (XPath 2.0). 0260 */ 0261 virtual const XMLCh* getStringValue() const = 0; 0262 0263 /** 0264 * Returns the node value of this result 0265 * @return nodeValue 0266 * The value of this node result, which may be null. 0267 * @exception DOMXPathException 0268 * TYPE_ERR: raised if ResultType is not ANY_UNORDERED_NODE_TYPE, 0269 * FIRST_ORDERED_NODE_TYPE, UNORDERED_NODE_ITERATOR_TYPE, 0270 * ORDERED_NODE_ITERATOR_TYPE, UNORDERED_NODE_SNAPSHOT_TYPE, or 0271 * ORDERED_NODE_SNAPSHOT_TYPE (XPath 1.0) or if current result is 0272 * not a node (XPath 2.0). 0273 * <br> 0274 * NO_RESULT_ERROR: raised if there is no current result in the result 0275 * object. 0276 */ 0277 virtual DOMNode* getNodeValue() const = 0; 0278 0279 /** 0280 * Iterates and returns true if the current result is the next item from the 0281 * sequence or false if there are no more items. 0282 * @return boolean True if the current result is the next item from the sequence 0283 * or false if there are no more items. 0284 * @exception XPathException 0285 * TYPE_ERR: raised if ResultType is not UNORDERED_NODE_ITERATOR_TYPE or 0286 * ORDERED_NODE_ITERATOR_TYPE (XPath 1.0) or if ResultType is not 0287 * ITERATOR_RESULT_TYPE (XPath 2.0). 0288 * @exception DOMException 0289 * INVALID_STATE_ERR: The document has been mutated since the result was returned. 0290 */ 0291 virtual bool iterateNext() = 0; 0292 0293 /** 0294 * Signifies that the iterator has become invalid. 0295 * @return invalidIteratorState 0296 * True if ResultType is UNORDERED_NODE_ITERATOR_TYPE or 0297 * ORDERED_NODE_ITERATOR_TYPE (XPath 1.0) or ITERATOR_RESULT_TYPE (XPath 2.0) 0298 * and the document has been modified since this result was returned. 0299 * @exception XPathException 0300 * TYPE_ERR: raised if ResultType is not UNORDERED_NODE_ITERATOR_TYPE or 0301 * ORDERED_NODE_ITERATOR_TYPE (XPath 1.0) or if ResultType is not 0302 * ITERATOR_RESULT_TYPE (XPath 2.0). 0303 */ 0304 virtual bool getInvalidIteratorState() const = 0; 0305 0306 /** 0307 * Sets the current result to the indexth item in the snapshot collection. If 0308 * index is greater than or equal to the number of items in the list, this method 0309 * returns false. Unlike the iterator result, the snapshot does not become 0310 * invalid, but may not correspond to the current document if it is mutated. 0311 * @param index of type XMLSize_t - Index into the snapshot collection. 0312 * @return boolean True if the current result is the next item from the sequence 0313 * or false if there are no more items. 0314 * @exception XPathException 0315 * TYPE_ERR: raised if ResultType is not UNORDERED_NODE_SNAPSHOT_TYPE or 0316 * ORDERED_NODE_SNAPSHOT_TYPE (XPath 1.0) or if ResultType is not 0317 * SNAPSHOT_RESULT_TYPE (XPath 2.0). 0318 */ 0319 virtual bool snapshotItem(XMLSize_t index) = 0; 0320 0321 /** 0322 * The number of items in the result snapshot. Valid values for snapshotItem 0323 * indices are 0 to snapshotLength-1 inclusive. 0324 * @return snapshotLength of type XMLSize_t 0325 * @exception XPathException 0326 * TYPE_ERR: raised if ResultType is not UNORDERED_NODE_SNAPSHOT_TYPE or 0327 * ORDERED_NODE_SNAPSHOT_TYPE (XPath 1.0) or if ResultType is not 0328 * SNAPSHOT_RESULT_TYPE (XPath 2.0). 0329 */ 0330 virtual XMLSize_t getSnapshotLength() const = 0; 0331 0332 //@} 0333 0334 // ----------------------------------------------------------------------- 0335 // Non-standard Extension 0336 // ----------------------------------------------------------------------- 0337 /** @name Non-standard Extension */ 0338 //@{ 0339 /** 0340 * Called to indicate that this DOMXPathResult is no longer in use 0341 * and that the implementation may relinquish any resources associated with it. 0342 * 0343 * Access to a released object will lead to unexpected result. 0344 */ 0345 virtual void release() = 0; 0346 //@} 0347 }; 0348 0349 XERCES_CPP_NAMESPACE_END 0350 0351 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|