source: NonGTP/Xerces/xercesc/dom/DOMXPathEvaluator.hpp @ 188

Revision 188, 10.7 KB checked in by mattausch, 19 years ago (diff)

added xercesc to support

Line 
1#ifndef DOMXPathEvaluator_HEADER_GUARD_
2#define DOMXPathEvaluator_HEADER_GUARD_
3
4/*
5 * The Apache Software License, Version 1.1
6 *
7 * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
8 * reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * 1. Redistributions of source code must retain the above copyright
15 *    notice, this list of conditions and the following disclaimer.
16 *
17 * 2. Redistributions in binary form must reproduce the above copyright
18 *    notice, this list of conditions and the following disclaimer in
19 *    the documentation and/or other materials provided with the
20 *    distribution.
21 *
22 * 3. The end-user documentation included with the redistribution,
23 *    if any, must include the following acknowledgment:
24 *       "This product includes software developed by the
25 *        Apache Software Foundation (http://www.apache.org/)."
26 *    Alternately, this acknowledgment may appear in the software itself,
27 *    if and wherever such third-party acknowledgments normally appear.
28 *
29 * 4. The names "Xerces" and "Apache Software Foundation" must
30 *    not be used to endorse or promote products derived from this
31 *    software without prior written permission. For written
32 *    permission, please contact apache\@apache.org.
33 *
34 * 5. Products derived from this software may not be called "Apache",
35 *    nor may "Apache" appear in their name, without prior written
36 *    permission of the Apache Software Foundation.
37 *
38 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
39 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
40 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
41 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
42 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
44 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
45 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
46 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
47 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
48 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
49 * SUCH DAMAGE.
50 * ====================================================================
51 *
52 * This software consists of voluntary contributions made by many
53 * individuals on behalf of the Apache Software Foundation, and was
54 * originally based on software copyright (c) 2001, International
55 * Business Machines, Inc., http://www.ibm.com .  For more information
56 * on the Apache Software Foundation, please see
57 * <http://www.apache.org/>.
58 */
59
60#include <xercesc/util/XercesDefs.hpp>
61
62XERCES_CPP_NAMESPACE_BEGIN
63
64class DOMXPathNSResolver;
65class DOMXPathExpression;
66class DOMNode;
67
68/**
69 * The evaluation of XPath expressions is provided by <code>DOMXPathEvaluator</code>.
70 * In a DOM implementation which supports the XPath 3.0 feature, the <code>DOMXPathEvaluator</code>
71 * interface will be implemented on the same object which implements the Document interface permitting
72 * it to be obtained by casting or by using the DOM Level 3 getInterface method. In this case the
73 * implementation obtained from the Document supports the XPath DOM module and is compatible
74 * with the XPath 1.0 specification.
75 * Evaluation of expressions with specialized extension functions or variables may not
76 * work in all implementations and is, therefore, not portable. XPathEvaluator implementations
77 * may be available from other sources that could provide specific support for specialized extension
78 * functions or variables as would be defined by other specifications.
79 * @since DOM Level 3
80 */
81class CDOM_EXPORT DOMXPathEvaluator
82{
83
84protected:
85    // -----------------------------------------------------------------------
86    //  Hidden constructors
87    // -----------------------------------------------------------------------
88    /** @name Hidden constructors */
89    //@{   
90    DOMXPathEvaluator() {};
91    //@}
92
93private:
94    // -----------------------------------------------------------------------
95    // Unimplemented constructors and operators
96    // -----------------------------------------------------------------------
97    /** @name Unimplemented constructors and operators */
98    //@{
99    DOMXPathEvaluator(const DOMXPathEvaluator &);
100    DOMXPathEvaluator& operator = (const  DOMXPathEvaluator&);
101    //@}
102
103public:
104    // -----------------------------------------------------------------------
105    //  All constructors are hidden, just the destructor is available
106    // -----------------------------------------------------------------------
107    /** @name Destructor */
108    //@{
109    /**
110     * Destructor
111     *
112     */
113    virtual ~DOMXPathEvaluator() {};
114    //@}
115
116    // -----------------------------------------------------------------------
117    // Virtual DOMDocument interface
118    // -----------------------------------------------------------------------
119    /** @name Functions introduced in DOM Level 3 */
120    //@{
121
122    /**
123     * Creates a parsed XPath expression with resolved namespaces. This is useful
124     * when an expression will be reused in an application since it makes it
125     * possible to compile the expression string into a more efficient internal
126     * form and preresolve all namespace prefixes which occur within the expression.
127     * @param expression of type XMLCh - The XPath expression string to be parsed.
128     * @param resolver of type <code>XPathNSResolver</code> - The resolver permits
129     * translation of all prefixes, including the xml namespace prefix, within the XPath expression
130     * into appropriate namespace URIs. If this is specified as null, any namespace
131     * prefix within the expression will result in <code>DOMException</code> being thrown with the
132     * code NAMESPACE_ERR.
133     * @return <code>XPathExpression</code> The compiled form of the XPath expression.
134     * @exception <code>XPathException</code>
135     * INVALID_EXPRESSION_ERR: Raised if the expression is not legal according to the
136     * rules of the <code>DOMXPathEvaluator</code>.
137     * @exception DOMException
138     * NAMESPACE_ERR: Raised if the expression contains namespace prefixes which cannot
139     * be resolved by the specified <code>XPathNSResolver</code>.
140     * @since DOM Level 3
141     */
142    virtual const DOMXPathExpression*    createExpression(const XMLCh *expression, const DOMXPathNSResolver *resolver) = 0;
143
144
145    /** Adapts any DOM node to resolve namespaces so that an XPath expression can be
146     * easily evaluated relative to the context of the node where it appeared within
147     * the document. This adapter works like the DOM Level 3 method lookupNamespaceURI
148     * on nodes in resolving the namespaceURI from a given prefix using the current
149     * information available in the node's hierarchy at the time lookupNamespaceURI
150     * is called. also correctly resolving the implicit xml prefix.
151     * @param nodeResolver of type <code>DOMNode</code> The node to be used as a context
152     * for namespace resolution.
153     * @return <code>XPathNSResolver</code> <code>XPathNSResolver</code> which resolves namespaces
154     * with respect to the definitions in scope for a specified node.
155     */
156    virtual const DOMXPathNSResolver*    createNSResolver(DOMNode *nodeResolver) = 0;
157
158
159    /**
160     * Evaluates an XPath expression string and returns a result of the specified
161     * type if possible.
162     * @param expression of type XMLCh The XPath expression string to be parsed
163     * and evaluated.
164     * @param contextNode of type <code>DOMNode</code> The context is context node
165     * for the evaluation
166     * of this XPath expression. If the <code>DOMXPathEvaluator</code> was obtained by
167     * casting the <code>DOMDocument</code> then this must be owned by the same
168     * document and must be a <code>DOMDocument</code>, <code>DOMElement</code>,
169     * <code>DOMAttribute</code>, <code>DOMText</code>, <code>DOMCDATASection</code>,
170     * <code>DOMComment</code>, <code>DOMProcessingInstruction</code>, or
171     * <code>XPathNamespace</code> node. If the context node is a <code>DOMText</code> or
172     * a <code>DOMCDATASection</code>, then the context is interpreted as the whole
173     * logical text node as seen by XPath, unless the node is empty in which case it
174     * may not serve as the XPath context.
175     * @param resolver of type <code>XPathNSResolver</code> The resolver permits
176     * translation of all prefixes, including the xml namespace prefix, within
177     * the XPath expression into appropriate namespace URIs. If this is specified
178     * as null, any namespace prefix within the expression will result in
179     * <code>DOMException</code> being thrown with the code NAMESPACE_ERR.
180     * @param type of type unsigned short - If a specific type is specified, then
181     * the result will be returned as the corresponding type.
182     * For XPath 1.0 results, this must be one of the codes of the <code>XPathResult</code>
183     * interface.
184     * @param result of type void* - The result specifies a specific result object
185     * which may be reused and returned by this method. If this is specified as
186     * null or the implementation does not reuse the specified result, a new result
187     * object will be constructed and returned.
188     * For XPath 1.0 results, this object will be of type <code>XPathResult</code>.
189     * @return void* The result of the evaluation of the XPath expression.
190     * For XPath 1.0 results, this object will be of type <code>XPathResult</code>.
191     * @exception <code>XPathException</code>
192     * INVALID_EXPRESSION_ERR: Raised if the expression is not legal
193     * according to the rules of the <code>DOMXPathEvaluator</code>
194     * TYPE_ERR: Raised if the result cannot be converted to return the specified type.
195     * @exception DOMException
196     * NAMESPACE_ERR: Raised if the expression contains namespace prefixes
197     * which cannot be resolved by the specified <code>XPathNSResolver</code>.
198     * WRONG_DOCUMENT_ERR: The Node is from a document that is not supported
199     * by this <code>DOMXPathEvaluator</code>.
200     * NOT_SUPPORTED_ERR: The Node is not a type permitted as an XPath context
201     * node or the request type is not permitted by this <code>DOMXPathEvaluator</code>.
202     */
203    virtual void* evaluate(const XMLCh *expression, DOMNode *contextNode, const DOMXPathNSResolver *resolver,
204                           unsigned short type, void* result) = 0;
205
206    //@}
207};
208
209XERCES_CPP_NAMESPACE_END
210
211#endif
Note: See TracBrowser for help on using the repository browser.