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 evaluator 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 XMLENGXPATHEVALUATOR_H
|
williamr@4
|
25 |
#define XMLENGXPATHEVALUATOR_H
|
williamr@4
|
26 |
|
williamr@4
|
27 |
#include <xml/dom/xmlengxpathexpression.h>
|
williamr@4
|
28 |
#include <xml/dom/xmlengxformsinstancemap.h>
|
williamr@4
|
29 |
#include <xml/dom/xmlengnamespaceresolver.h>
|
williamr@4
|
30 |
|
williamr@4
|
31 |
class MXmlEngXPathExtensionFunction;
|
williamr@4
|
32 |
|
williamr@4
|
33 |
class MXmlEngNamespaceResolver;
|
williamr@4
|
34 |
/**
|
williamr@4
|
35 |
Evaluates XPath expressions on a DOM tree.
|
williamr@4
|
36 |
|
williamr@4
|
37 |
See the XPath specfication here:
|
williamr@4
|
38 |
http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226/xpath.html
|
williamr@4
|
39 |
*/
|
williamr@4
|
40 |
class TXmlEngXPathEvaluator
|
williamr@4
|
41 |
{
|
williamr@4
|
42 |
public:
|
williamr@4
|
43 |
/** Default constructor */
|
williamr@4
|
44 |
IMPORT_C TXmlEngXPathEvaluator();
|
williamr@4
|
45 |
|
williamr@4
|
46 |
// XPath 1.0 methods
|
williamr@4
|
47 |
|
williamr@4
|
48 |
/**
|
williamr@4
|
49 |
Precompiles and stores an XPath expression, which is returned to caller.
|
williamr@4
|
50 |
|
williamr@4
|
51 |
Information on how to write XPath expressions can be found here:
|
williamr@4
|
52 |
@see http://en.wikipedia.org/wiki/XPath
|
williamr@4
|
53 |
|
williamr@4
|
54 |
@param aExpression The expression to create
|
williamr@4
|
55 |
@param aResolver Not supported in current API. Reserved for future use.
|
williamr@4
|
56 |
@return The compiled XPath expression.
|
williamr@4
|
57 |
@leave KXmlEngErrXPathSyntax Error compiling expression
|
williamr@4
|
58 |
@leave KErrNoMemory Memory allocation error
|
williamr@4
|
59 |
@leave - Otherwise, any of the system wide errors.
|
williamr@4
|
60 |
*/
|
williamr@4
|
61 |
IMPORT_C RXmlEngXPathExpression CreateExpressionL(const TDesC8& aExpression,
|
williamr@4
|
62 |
const MXmlEngNamespaceResolver* aResolver = NULL);
|
williamr@4
|
63 |
|
williamr@4
|
64 |
/**
|
williamr@4
|
65 |
Evaluates the XPath expression given as a parameter and returns the result.
|
williamr@4
|
66 |
|
williamr@4
|
67 |
@param aExpression The expression to evaluate
|
williamr@4
|
68 |
@param aContextNode The node relative to which the expression is evaluated.
|
williamr@4
|
69 |
@param aResolver Not supported in current API. Reserved for future use.
|
williamr@4
|
70 |
@return The result of the evaluation.
|
williamr@4
|
71 |
@leave KXmlEngErrXPathResult Error evaluating expression
|
williamr@4
|
72 |
@leave KXmlEngErrXPathSyntax Error compiling expression
|
williamr@4
|
73 |
@leave KErrNoMemory Memory allocation error
|
williamr@4
|
74 |
@leave - Otherwise, any of the system wide errors.
|
williamr@4
|
75 |
*/
|
williamr@4
|
76 |
IMPORT_C RXmlEngXPathResult EvaluateL(const TDesC8& aExpression,
|
williamr@4
|
77 |
const TXmlEngNode aContextNode,
|
williamr@4
|
78 |
const MXmlEngNamespaceResolver* aResolver = NULL);
|
williamr@4
|
79 |
|
williamr@4
|
80 |
|
williamr@4
|
81 |
// Extensions to XPath 1.0
|
williamr@4
|
82 |
|
williamr@4
|
83 |
/**
|
williamr@4
|
84 |
Does the same thing as EvaluateL(), but also calculates the dependency list
|
williamr@4
|
85 |
of the expression.
|
williamr@4
|
86 |
|
williamr@4
|
87 |
@param aExpression The expression to evaluate
|
williamr@4
|
88 |
@param aContextNode The node relative to which the expression is evaluated.
|
williamr@4
|
89 |
@param aResolver Not supported in current API. Reserved for future use.
|
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 |
@return The result of evaluation
|
williamr@4
|
93 |
|
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(const TDesC8& aExpression,
|
williamr@4
|
100 |
const TXmlEngNode aContextNode,
|
williamr@4
|
101 |
const MXmlEngNamespaceResolver* aResolver,
|
williamr@4
|
102 |
RXmlEngNodeSet& aDependents);
|
williamr@4
|
103 |
|
williamr@4
|
104 |
/**
|
williamr@4
|
105 |
Registers the instance map to be used when evaluating form expressions. The map
|
williamr@4
|
106 |
contains DOM Documents and their names. For example, when evaluating the expression
|
williamr@4
|
107 |
"instance('a')" the evaluator looks up a document that has the name "a" from the map.
|
williamr@4
|
108 |
|
williamr@4
|
109 |
@param aInstanceTrees The instance map, ownership is not transferred.
|
williamr@4
|
110 |
*/
|
williamr@4
|
111 |
IMPORT_C void SetInstanceMap(CXmlEngXFormsInstanceMap* aInstanceTrees);
|
williamr@4
|
112 |
|
williamr@4
|
113 |
/**
|
williamr@4
|
114 |
Returns the registered instance map. Ownership is not transferred.
|
williamr@4
|
115 |
@return A pointer to the instance map or NULL if not registered.
|
williamr@4
|
116 |
*/
|
williamr@4
|
117 |
IMPORT_C CXmlEngXFormsInstanceMap* InstanceMap();
|
williamr@4
|
118 |
|
williamr@4
|
119 |
private:
|
williamr@4
|
120 |
CXmlEngXFormsInstanceMap* iInstanceTrees;
|
williamr@4
|
121 |
};
|
williamr@4
|
122 |
|
williamr@4
|
123 |
|
williamr@4
|
124 |
|
williamr@4
|
125 |
#endif /* XMLENGXPATHEVALUATOR_H */
|
williamr@4
|
126 |
|