williamr@4: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@4: // All rights reserved. williamr@4: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@4: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: // williamr@4: // Initial Contributors: williamr@4: // Nokia Corporation - initial contribution. williamr@4: // williamr@4: // Contributors: williamr@4: // williamr@4: // Description: williamr@4: // XPath evaluator declaration williamr@4: // williamr@4: williamr@4: williamr@4: williamr@4: /** williamr@4: @file williamr@4: @publishedAll williamr@4: @released williamr@4: */ williamr@4: #ifndef XMLENGXPATHEVALUATOR_H williamr@4: #define XMLENGXPATHEVALUATOR_H williamr@4: williamr@4: #include williamr@4: #include williamr@4: #include williamr@4: williamr@4: class MXmlEngXPathExtensionFunction; williamr@4: williamr@4: class MXmlEngNamespaceResolver; williamr@4: /** williamr@4: Evaluates XPath expressions on a DOM tree. williamr@4: williamr@4: See the XPath specfication here: williamr@4: http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226/xpath.html williamr@4: */ williamr@4: class TXmlEngXPathEvaluator williamr@4: { williamr@4: public: williamr@4: /** Default constructor */ williamr@4: IMPORT_C TXmlEngXPathEvaluator(); williamr@4: williamr@4: // XPath 1.0 methods williamr@4: williamr@4: /** williamr@4: Precompiles and stores an XPath expression, which is returned to caller. williamr@4: williamr@4: Information on how to write XPath expressions can be found here: williamr@4: @see http://en.wikipedia.org/wiki/XPath williamr@4: williamr@4: @param aExpression The expression to create williamr@4: @param aResolver Not supported in current API. Reserved for future use. williamr@4: @return The compiled XPath expression. williamr@4: @leave KXmlEngErrXPathSyntax Error compiling expression williamr@4: @leave KErrNoMemory Memory allocation error williamr@4: @leave - Otherwise, any of the system wide errors. williamr@4: */ williamr@4: IMPORT_C RXmlEngXPathExpression CreateExpressionL(const TDesC8& aExpression, williamr@4: const MXmlEngNamespaceResolver* aResolver = NULL); williamr@4: williamr@4: /** williamr@4: Evaluates the XPath expression given as a parameter and returns the result. williamr@4: williamr@4: @param aExpression The expression to evaluate williamr@4: @param aContextNode The node relative to which the expression is evaluated. williamr@4: @param aResolver Not supported in current API. Reserved for future use. williamr@4: @return The result of the evaluation. williamr@4: @leave KXmlEngErrXPathResult Error evaluating expression williamr@4: @leave KXmlEngErrXPathSyntax Error compiling expression williamr@4: @leave KErrNoMemory Memory allocation error williamr@4: @leave - Otherwise, any of the system wide errors. williamr@4: */ williamr@4: IMPORT_C RXmlEngXPathResult EvaluateL(const TDesC8& aExpression, williamr@4: const TXmlEngNode aContextNode, williamr@4: const MXmlEngNamespaceResolver* aResolver = NULL); williamr@4: williamr@4: williamr@4: // Extensions to XPath 1.0 williamr@4: williamr@4: /** williamr@4: Does the same thing as EvaluateL(), but also calculates the dependency list williamr@4: of the expression. williamr@4: williamr@4: @param aExpression The expression to evaluate williamr@4: @param aContextNode The node relative to which the expression is evaluated. williamr@4: @param aResolver Not supported in current API. Reserved for future use. williamr@4: @param aDependents After the method has returned, contains set of nodes that williamr@4: the expression is dependent on. williamr@4: @return The result of evaluation williamr@4: williamr@4: @leave KXmlEngErrXPathResult Error evaluating expression williamr@4: @leave KXmlEngErrXPathSyntax Error compiling expression williamr@4: @leave KErrNoMemory Memory allocation error williamr@4: @leave - Otherwise, any of the system wide errors. williamr@4: */ williamr@4: IMPORT_C RXmlEngXPathResult EvaluateWithDependenciesL(const TDesC8& aExpression, williamr@4: const TXmlEngNode aContextNode, williamr@4: const MXmlEngNamespaceResolver* aResolver, williamr@4: RXmlEngNodeSet& aDependents); williamr@4: williamr@4: /** williamr@4: Registers the instance map to be used when evaluating form expressions. The map williamr@4: contains DOM Documents and their names. For example, when evaluating the expression williamr@4: "instance('a')" the evaluator looks up a document that has the name "a" from the map. williamr@4: williamr@4: @param aInstanceTrees The instance map, ownership is not transferred. williamr@4: */ williamr@4: IMPORT_C void SetInstanceMap(CXmlEngXFormsInstanceMap* aInstanceTrees); williamr@4: williamr@4: /** williamr@4: Returns the registered instance map. Ownership is not transferred. williamr@4: @return A pointer to the instance map or NULL if not registered. williamr@4: */ williamr@4: IMPORT_C CXmlEngXFormsInstanceMap* InstanceMap(); williamr@4: williamr@4: private: williamr@4: CXmlEngXFormsInstanceMap* iInstanceTrees; williamr@4: }; williamr@4: williamr@4: williamr@4: williamr@4: #endif /* XMLENGXPATHEVALUATOR_H */ williamr@4: