1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // XPath evaluator declaration
24 #ifndef XMLENGXPATHEVALUATOR_H
25 #define XMLENGXPATHEVALUATOR_H
27 #include <xml/dom/xmlengxpathexpression.h>
28 #include <xml/dom/xmlengxformsinstancemap.h>
29 #include <xml/dom/xmlengnamespaceresolver.h>
31 class MXmlEngXPathExtensionFunction;
33 class MXmlEngNamespaceResolver;
35 Evaluates XPath expressions on a DOM tree.
37 See the XPath specfication here:
38 http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226/xpath.html
40 class TXmlEngXPathEvaluator
43 /** Default constructor */
44 IMPORT_C TXmlEngXPathEvaluator();
49 Precompiles and stores an XPath expression, which is returned to caller.
51 Information on how to write XPath expressions can be found here:
52 @see http://en.wikipedia.org/wiki/XPath
54 @param aExpression The expression to create
55 @param aResolver Not supported in current API. Reserved for future use.
56 @return The compiled XPath expression.
57 @leave KXmlEngErrXPathSyntax Error compiling expression
58 @leave KErrNoMemory Memory allocation error
59 @leave - Otherwise, any of the system wide errors.
61 IMPORT_C RXmlEngXPathExpression CreateExpressionL(const TDesC8& aExpression,
62 const MXmlEngNamespaceResolver* aResolver = NULL);
65 Evaluates the XPath expression given as a parameter and returns the result.
67 @param aExpression The expression to evaluate
68 @param aContextNode The node relative to which the expression is evaluated.
69 @param aResolver Not supported in current API. Reserved for future use.
70 @return The result of the evaluation.
71 @leave KXmlEngErrXPathResult Error evaluating expression
72 @leave KXmlEngErrXPathSyntax Error compiling expression
73 @leave KErrNoMemory Memory allocation error
74 @leave - Otherwise, any of the system wide errors.
76 IMPORT_C RXmlEngXPathResult EvaluateL(const TDesC8& aExpression,
77 const TXmlEngNode aContextNode,
78 const MXmlEngNamespaceResolver* aResolver = NULL);
81 // Extensions to XPath 1.0
84 Does the same thing as EvaluateL(), but also calculates the dependency list
87 @param aExpression The expression to evaluate
88 @param aContextNode The node relative to which the expression is evaluated.
89 @param aResolver Not supported in current API. Reserved for future use.
90 @param aDependents After the method has returned, contains set of nodes that
91 the expression is dependent on.
92 @return The result of evaluation
94 @leave KXmlEngErrXPathResult Error evaluating expression
95 @leave KXmlEngErrXPathSyntax Error compiling expression
96 @leave KErrNoMemory Memory allocation error
97 @leave - Otherwise, any of the system wide errors.
99 IMPORT_C RXmlEngXPathResult EvaluateWithDependenciesL(const TDesC8& aExpression,
100 const TXmlEngNode aContextNode,
101 const MXmlEngNamespaceResolver* aResolver,
102 RXmlEngNodeSet& aDependents);
105 Registers the instance map to be used when evaluating form expressions. The map
106 contains DOM Documents and their names. For example, when evaluating the expression
107 "instance('a')" the evaluator looks up a document that has the name "a" from the map.
109 @param aInstanceTrees The instance map, ownership is not transferred.
111 IMPORT_C void SetInstanceMap(CXmlEngXFormsInstanceMap* aInstanceTrees);
114 Returns the registered instance map. Ownership is not transferred.
115 @return A pointer to the instance map or NULL if not registered.
117 IMPORT_C CXmlEngXFormsInstanceMap* InstanceMap();
120 CXmlEngXFormsInstanceMap* iInstanceTrees;
125 #endif /* XMLENGXPATHEVALUATOR_H */