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 // Result of XPath expression
24 #ifndef XMLENGXPATHRESULT_H
25 #define XMLENGXPATHRESULT_H
27 #include <xml/dom/xmlengnodeset.h>
30 Represents the result of a XPath expression.
32 The result may be one of the standard types: string, boolean, number (float),
33 node set or be undefined in the case of error.
35 The returned result should be freed after use.
37 class RXmlEngXPathResult
39 friend class RXmlEngXPathExpression;
40 friend class TXmlEngXPathEvaluationContextImpl;
44 Result types of a XPath expression.
45 See http://w3.org/TR/xpath#section-Introduction
47 enum TXmlEngXPathResultType
54 //Other node types defined in XPath are not supported.
58 /** Default constructor */
59 IMPORT_C RXmlEngXPathResult();
61 /** Frees any allocated memory */
64 /** Frees any allocated memory */
68 Retrieves the type of the result (e.g. boolean, number, string, etc.).
69 The type of a result should always be checked before using the result.
71 If there was an error and no value was set, undefined is returned.
72 Otherwise nodeset is returned.
74 @return Type of result.
76 @see TXmlEngXPathResultType
78 IMPORT_C TXmlEngXPathResultType Type() const;
81 Retrieves a node-set result. A Non-RXmlEngNodeSet result will return NULL.
82 No conversion is done from other types.
84 For more information no NULL nodes:
87 @return Node-set result
89 IMPORT_C RXmlEngNodeSet AsNodeSet() const;
92 Retrieves a string copy of result.
93 @param A buffer allocated by the caller that holds the result string
94 @leave KErrNoMemory if out of memory situation occurs.
95 @leave - Otherwise any of the system wide errors.
97 IMPORT_C void AsStringL(RBuf8& aOutput) const;
100 Retrieves a numeric value result. Conversion can occur from other types.
102 Node sets, strings, and booleans will be cast to numbers. Anything else
103 will return NAN (i.e. not a number).
105 @return Numeric value of the result.
109 IMPORT_C TReal AsNumber() const;
112 Retrieves a boolean result. Conversion can occur from other types.
114 Numbers will be returned as true unless it is not a number or 0.0.
115 A string of 0 length will return false, otherwise true.
116 If the node exists it will be returned as true, otherwise false.
118 @return Boolean value of the result
120 IMPORT_C TBool AsBoolean() const;
125 @param aData Internal representation of XPath result
127 RXmlEngXPathResult(void* aData);
133 #include <xml/dom/xmlengxpathresult.inl>
135 #endif /* XMLENGXPATHRESULT_H */