williamr@4
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@4
|
2 |
// All rights reserved.
|
williamr@4
|
3 |
// This component and the accompanying materials are made available
|
williamr@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@4
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@4
|
7 |
//
|
williamr@4
|
8 |
// Initial Contributors:
|
williamr@4
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@4
|
10 |
//
|
williamr@4
|
11 |
// Contributors:
|
williamr@4
|
12 |
//
|
williamr@4
|
13 |
// Description:
|
williamr@4
|
14 |
// XPath expression declaration
|
williamr@4
|
15 |
//
|
williamr@4
|
16 |
|
williamr@4
|
17 |
|
williamr@4
|
18 |
|
williamr@4
|
19 |
/**
|
williamr@4
|
20 |
@file
|
williamr@4
|
21 |
@publishedAll
|
williamr@4
|
22 |
@released
|
williamr@4
|
23 |
*/
|
williamr@4
|
24 |
#ifndef XMLENGXPATHEXPRESSION_H
|
williamr@4
|
25 |
#define XMLENGXPATHEXPRESSION_H
|
williamr@4
|
26 |
|
williamr@4
|
27 |
#include <xml/dom/xmlengxpathresult.h>
|
williamr@4
|
28 |
#include <xml/dom/xmlengnamespaceresolver.h>
|
williamr@4
|
29 |
|
williamr@4
|
30 |
class TXmlEngNode;
|
williamr@4
|
31 |
|
williamr@4
|
32 |
/**
|
williamr@4
|
33 |
A compiled XPath expression is a textual expression transformed after
|
williamr@4
|
34 |
syntactical analysis into some internal representation of the expression. The
|
williamr@4
|
35 |
only missing element for evaluation of the expression is evaluation context:
|
williamr@4
|
36 |
the context node (where to start) and an optional set of prefix-to-namespace bindings.
|
williamr@4
|
37 |
|
williamr@4
|
38 |
XPath Expressions are created and instantiated by the Evaluator:
|
williamr@4
|
39 |
@see TXmlEngXPathEvaluator
|
williamr@4
|
40 |
|
williamr@4
|
41 |
See the XPath spec here:
|
williamr@4
|
42 |
http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226/xpath.html
|
williamr@4
|
43 |
*/
|
williamr@4
|
44 |
class RXmlEngXPathExpression
|
williamr@4
|
45 |
{
|
williamr@4
|
46 |
friend class TXmlEngXPathEvaluator;
|
williamr@4
|
47 |
|
williamr@4
|
48 |
public:
|
williamr@4
|
49 |
/** XPath expression parts */
|
williamr@4
|
50 |
enum TXmlEngXPathExpressionPartType
|
williamr@4
|
51 |
{
|
williamr@4
|
52 |
EFunction,
|
williamr@4
|
53 |
EPrefix
|
williamr@4
|
54 |
};
|
williamr@4
|
55 |
|
williamr@4
|
56 |
public:
|
williamr@4
|
57 |
/** Default constructor */
|
williamr@4
|
58 |
IMPORT_C RXmlEngXPathExpression();
|
williamr@4
|
59 |
|
williamr@4
|
60 |
/** Resets the compiled expression and frees the allocated memory */
|
williamr@4
|
61 |
IMPORT_C void Destroy();
|
williamr@4
|
62 |
|
williamr@4
|
63 |
/** Resets the compiled expression and frees the allocated memory */
|
williamr@4
|
64 |
inline void Close();
|
williamr@4
|
65 |
|
williamr@4
|
66 |
// XPath 1.0 methods
|
williamr@4
|
67 |
|
williamr@4
|
68 |
/**
|
williamr@4
|
69 |
Evaluates this expression.
|
williamr@4
|
70 |
|
williamr@4
|
71 |
@param aContextNode The node relative to which the expression is evaluated.
|
williamr@4
|
72 |
@param aResolver Not supported in current API. Reserved for future use.
|
williamr@4
|
73 |
@return Result of evaluation
|
williamr@4
|
74 |
@leave KXmlEngErrXPathResult Error evaluating expression
|
williamr@4
|
75 |
@leave KXmlEngErrXPathSyntax Error compiling expression
|
williamr@4
|
76 |
@leave KErrNoMemory Memory allocation error
|
williamr@4
|
77 |
@leave - Otherwise, any of the system wide errors.
|
williamr@4
|
78 |
*/
|
williamr@4
|
79 |
IMPORT_C RXmlEngXPathResult EvaluateL(TXmlEngNode aContextNode,
|
williamr@4
|
80 |
const MXmlEngNamespaceResolver* aResolver = NULL) const;
|
williamr@4
|
81 |
|
williamr@4
|
82 |
|
williamr@4
|
83 |
// Extensions to XPath 1.0
|
williamr@4
|
84 |
|
williamr@4
|
85 |
/**
|
williamr@4
|
86 |
Does the same thing as EvaluateL(), but also calculates the dependency list
|
williamr@4
|
87 |
of the expression.
|
williamr@4
|
88 |
|
williamr@4
|
89 |
@param aContextNode The node relative to which the expression is evaluated.
|
williamr@4
|
90 |
@param aDependents After the method has returned, contains set of nodes that
|
williamr@4
|
91 |
the expression is dependent on.
|
williamr@4
|
92 |
@param aResolver Not supported in current API. Reserved for future use.
|
williamr@4
|
93 |
@return Result of evaluation
|
williamr@4
|
94 |
@leave KXmlEngErrXPathResult Error evaluating expression
|
williamr@4
|
95 |
@leave KXmlEngErrXPathSyntax Error compiling expression
|
williamr@4
|
96 |
@leave KErrNoMemory Memory allocation error
|
williamr@4
|
97 |
@leave - Otherwise, any of the system wide errors.
|
williamr@4
|
98 |
*/
|
williamr@4
|
99 |
IMPORT_C RXmlEngXPathResult EvaluateWithDependenciesL(TXmlEngNode aContextNode,
|
williamr@4
|
100 |
RXmlEngNodeSet& aDependents,
|
williamr@4
|
101 |
const MXmlEngNamespaceResolver* aResolver = NULL) const;
|
williamr@4
|
102 |
|
williamr@4
|
103 |
/**
|
williamr@4
|
104 |
Set context data for the expression currently being evaluated.
|
williamr@4
|
105 |
|
williamr@4
|
106 |
Extended Context is data set by API users and available for XPath extension
|
williamr@4
|
107 |
functions. For more information:
|
williamr@4
|
108 |
@see RXmlEngXPathExpression
|
williamr@4
|
109 |
|
williamr@4
|
110 |
@param aContext Extended context pointer
|
williamr@4
|
111 |
*/
|
williamr@4
|
112 |
IMPORT_C void SetExtendedContext(void* aContext);
|
williamr@4
|
113 |
|
williamr@4
|
114 |
/**
|
williamr@4
|
115 |
Gets extended context data for the expression currently being evaluated.
|
williamr@4
|
116 |
|
williamr@4
|
117 |
@return Extended context pointer or NULL if not sete
|
williamr@4
|
118 |
|
williamr@4
|
119 |
@see SetExtendedContext
|
williamr@4
|
120 |
*/
|
williamr@4
|
121 |
IMPORT_C void* ExtendedContext() const;
|
williamr@4
|
122 |
|
williamr@4
|
123 |
private:
|
williamr@4
|
124 |
RXmlEngXPathExpression(void* aData, void* aData2);
|
williamr@4
|
125 |
|
williamr@4
|
126 |
private:
|
williamr@4
|
127 |
void* iInternal;
|
williamr@4
|
128 |
void* iInternal2;
|
williamr@4
|
129 |
TInt32 reserved1;
|
williamr@4
|
130 |
TAny* reserved2;
|
williamr@4
|
131 |
};
|
williamr@4
|
132 |
|
williamr@4
|
133 |
#include <xml/dom/xmlengxpathexpression.inl>
|
williamr@4
|
134 |
|
williamr@4
|
135 |
#endif /* XMLENGXPATHEXPRESSION_H */
|
williamr@4
|
136 |
|