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 evaluation context interface
24 #ifndef XMLENGXPATHEVALCTXT_H
25 #define XMLENGXPATHEVALCTXT_H
27 #include <xml/dom/xmlengxpathresult.h>
28 #include <xml/dom/xmlengelement.h>
31 Provides the XPath evaluation context interface. An object of this type
32 provides the argument values to an extension function to be evalutated
33 and stores the result of evalutation.
35 @see MXmlEngXPathExtensionFunction
36 @see MXmlEngXPathExtensionFunction::Evaluate()
38 Objects of this type are not registered with the XPath library and must
39 be destroyed by their owner.
41 Any memory allocated by this object must be freed when the object is
44 class MXmlEngXPathEvaluationContext
48 Gets the number of arguments provided.
49 @return The number of arguments provided
51 virtual TUint ArgCount() = 0;
54 Gets an argument by index. Does not transfer ownership. Index starts at 0.
55 @pre 0 <= aIndex < ArgCount(). Function panics if precondition not met.
56 @return The n-th argument of the function
58 virtual const RXmlEngXPathResult Argument(TUint aIndex) = 0;
61 Gets the result written so far. The result is undefined before SetResult(),
62 InitializeNodeSetResult() or AppendToResult() have been called.
64 @pre SetResult() or InitializeNodeSetResult() and AppendToResult() have
65 been previously called.
66 @return The result evaluated by the function so far.
68 virtual const RXmlEngXPathResult Result() = 0;
71 Sets the type of result to node set and initializes a new node set. Any
72 existing result node set is replaced.
74 @see AppendToResult(const TXmlEngNode)
75 @see AppendToResult(const RXmlEngNodeSet)
76 @see AppendToResult(const TXmlEngNamespace, const TXmlEngElement)
78 virtual void InitializeNodeSetResult() = 0;
81 Appends a node to the node set result. InitializeNodeSetResult() should be
82 called prior to the first call to an AppendToResult() method.
84 This method will return and do nothing if a previous OOM condition in the
85 underlying libxml2 library has not been cleared. See libxml2_modules.h.
87 @pre OOM_FLAG==0, otherwise method returns and does nothing.
88 @param aNode Node to be added
90 virtual void AppendToResult(const TXmlEngNode aNode) = 0;
93 Appends a namespace node to the node set result. InitializeNodeSetResult()
94 should be called prior to the first call to an AppendToResult() method.
96 A namespace node is the representation of an existing namespace declaration
97 within an element node. This function cannot be used to add a new namespace
98 declaration, rather it adds an existing namespace declaration attached to
101 @see TXmlEngNamespace
103 This method will return and do nothing if a previous OOM condition in the
104 underlying libxml2 library has not been cleared. See libxml2_modules.h.
106 @pre OOM_FLAG==0, otherwise method returns and does nothing.
107 @param aAppendedNsNode A namspace node to add to the node set result.
108 @param aNsParentNode An element node that holds the namespace declaration
109 represented by aAppendedNsNode.
111 virtual void AppendToResult(const TXmlEngNamespace aAppendedNsNode,
112 const TXmlEngElement aNsParentNode) = 0;
115 Appends a node set to the node set result. Nodes are merged into a
116 resulting node set. InitializeNodeSetResult() should be called prior to
117 the first call to an AppendToResult() method.
119 This method will return and do nothing if a previous OOM condition in the
120 underlying libxml2 library has not been cleared. See libxml2_modules.h.
122 @pre OOM_FLAG==0, otherwise method returns and does nothing.
123 @param aNodeSet The node set to be appended
125 virtual void AppendToResult(const RXmlEngNodeSet aNodeSet) = 0;
128 Sets the type of result to floating point number and stores the number as
130 @param aNumber The number to store as the result
132 virtual void SetResult(TReal aNumber) = 0;
135 Sets the type of result to boolean and stores the value as the result.
136 @param aBoolean The value to store as the result
138 virtual void SetResult(TBool aBoolean) = 0;
141 Sets the type of result to string and stores the string as the result.
142 @param aString The string to store as the result
144 virtual void SetResultL(const TDesC8& aString) = 0;
147 Gets the data specified in RXmlEngXPathExpression::SetExtendedContext()
148 for the expression currently being evaluated.
150 virtual void* ExtendedContext() = 0;
153 #endif /* XMLENGXPATHEVALCTXT_H */