Xalan-C++ API Reference  1.12.0
XPathCAPI.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 #if !defined(XALAN_XPATHCAPI_HEADER_GUARD_1357924680)
19 #define XALAN_XPATHCAPI_HEADER_GUARD_1357924680
20 
21 
22 
23 #if defined(_MSC_VER)
24 
25 #if defined(XALAN_BUILD_DLL)
26 
27 #define XALAN_XPATHCAPI_EXPORT __declspec(dllexport)
28 #define XALAN_XPATHCAPI_EXPORT_FUNCTION(T) T __declspec(dllexport)
29 
30 #else
31 
32 #define XALAN_XPATHCAPI_EXPORT __declspec(dllimport)
33 #define XALAN_XPATHCAPI_EXPORT_FUNCTION(T) T __declspec(dllimport)
34 
35 #endif
36 
37 #else
38 
39 #define XALAN_XPATHCAPI_EXPORT
40 #define XALAN_XPATHCAPI_EXPORT_FUNCTION(T) T
41 
42 #endif
43 
44 
45 
46 /**
47  * This is a simple C interface for the class XPathEvaluator. It's
48  * the user's responsibility to call XalanXPathAPIInitialize() before making
49  * any other API calls, and to call XalanXPathAPITerminate() when finished
50  * with the API.
51  */
52 #if defined(__cplusplus)
53 extern "C"
54 {
55 #endif
56 
57 #define XALAN_XPATH_API_SUCCESS 0
58 #define XALAN_XPATH_API_ERROR_ALREADY_INITIALIZED 1
59 #define XALAN_XPATH_API_ERROR_ALREADY_TERMINATED 2
60 #define XALAN_XPATH_API_ERROR_INITIALIZATION_FAILED 3
61 #define XALAN_XPATH_API_ERROR_TERMINATION_FAILED 4
62 #define XALAN_XPATH_API_ERROR_NOT_INITIALIZED 5
63 #define XALAN_XPATH_API_ERROR_CANNOT_REINITIALIZE 6
64 #define XALAN_XPATH_API_ERROR_INVALID_PARAMETER 7
65 #define XALAN_XPATH_API_ERROR_INVALID_EXPRESSION 8
66 #define XALAN_XPATH_API_ERROR_BAD_XML 9
67 #define XALAN_XPATH_API_ERROR_UNSUPPORTED_ENCODING 10
68 #define XALAN_XPATH_API_ERROR_TRANSCODING 11
69 #define XALAN_XPATH_API_ERROR_INVALID_XPATH 12
70 #define XALAN_XPATH_API_ERROR_UNKNOWN 13
71 
72 
73 /**
74  * Handle used to store the address of XalanTransformer instance.
75  */
77 
78 /**
79  * Handle used to store the address of compiled XPath instance.
80  */
81 typedef void* XalanXPathHandle;
82 
83 
84 #if defined(OS390)
85 #pragma export(XalanXPathAPIInitialize)
86 #pragma export(XalanXPathAPITerminate)
87 #pragma export(XalanCreateXPathEvaluator)
88 #pragma export(XalanDestroyXPathEvaluator)
89 #pragma export(XalanCreateXPath)
90 #pragma export(XalanDestroyXPath)
91 #pragma export(XalanEvaluateXPathAsBoolean)
92 #pragma export(XalanEvaluateXPathExpressionAsBoolean)
93 #endif
94 
95 /**
96  * Initialize Xerces and the XPath API.
97  *
98  * Should be called only once per process before making
99  * any other API calls.
100  *
101  * @return 0 for success, or a non-zero error code upon failure
102  */
105 
106 /**
107  * Terminate Xerces and the XPath API.
108  *
109  * Should be called only once per process after deleting all
110  * instances of XalanXPathEvaluator. Once a process has called
111  * this function, it cannot use the API for the remaining
112  * lifetime of the process.
113  *
114  * @return 0 for success, or a non-zero error code upon failure
115  */
118 
119 /**
120  * Create a XalanXPathEvaluator instance.
121  *
122  * @param theXalanHandle A pointer to the handle for the new instance.
123  * @return 0 for success, or a non-zero error code upon failure
124  */
127 
128 /**
129  * Destroy a XalanXPathEvaluator instance.
130  *
131  * @param theXalanHandle The handle of the instance to destroy.
132  * @return 0 for success, or a non-zero error code upon failure
133  */
136 
137 /**
138  * Creates a compiled XPath instance.
139  *
140  * @param theXalanHandle The handle of XalanXPathEvaluatorHandle instance.
141  * @param theXPathExpression The expression to compile
142  * @param theXPathExpressionEncoding The encoding of the expression. If NULL or an empty string, the local code page is assumed.
143  * @param theXPathHandle A pointer to the handle for the new instance
144  * @return 0 for success, or a non-zero error code upon failure
145  */
148  XalanXPathEvaluatorHandle theXalanHandle,
149  const char* theXPathExpression,
150  const char* theXPathExpressionEncoding,
151  XalanXPathHandle* theXPathHandle);
152 
153 /**
154  * Destroys a compiled XPath instance.
155  *
156  * @param theXalanHandle The handle of XalanXPathEvaluatorHandle instance.
157  * @param theXPathHandle The handle of XPath instance
158  * @return 0 for success, or a non-zero error code upon failure
159  */
162  XalanXPathEvaluatorHandle theXalanHandle,
163  XalanXPathHandle theXPathHandle);
164 
165 /**
166  * Evaluates a compiled XPath instance.
167  *
168  * @param theXalanHandle The handle of XalanXPathEvaluatorHandle instance.
169  * @param theXPathHandle The pointer to handle for instance
170  * @param theXML The XML document to use for evaluating the XPath expression
171  * @param theResult A pointer to an int to receive the result.
172  * @return 0 for success, or a non-zero error code upon failure
173  */
176  XalanXPathEvaluatorHandle theXalanHandle,
177  XalanXPathHandle theXPathHandle,
178  const char* theXML,
179  int* theResult);
180 
181 /**
182  * Evaluates an XPath expression
183  *
184  * @param theXalanHandle The handle of XalanXPathEvaluatorHandle instance.
185  * @param theXPathExpression The expression to evaluate
186  * @param theXPathExpressionEncoding The encoding of the expression. If NULL or an empty string, the local code page is assumed.
187  * @param theXML The XML document to use for evaluating the XPath expression
188  * @param theResult A pointer to an int to receive the result.
189  * @return 0 for success, or a non-zero error code upon failure
190  */
193  XalanXPathEvaluatorHandle theXalanHandle,
194  const char* theXPathExpression,
195  const char* theXPathExpressionEncoding,
196  const char* theXML,
197  int* theResult);
198 
199 #if defined(__cplusplus)
200 }
201 #endif
202 
203 
204 
205 #endif
XalanCreateXPath
XalanCreateXPath(XalanXPathEvaluatorHandle theXalanHandle, const char *theXPathExpression, const char *theXPathExpressionEncoding, XalanXPathHandle *theXPathHandle)
Creates a compiled XPath instance.
XalanXPathEvaluatorHandle
void * XalanXPathEvaluatorHandle
Handle used to store the address of XalanTransformer instance.
Definition: XPathCAPI.h:76
XalanEvaluateXPathExpressionAsBoolean
XalanEvaluateXPathExpressionAsBoolean(XalanXPathEvaluatorHandle theXalanHandle, const char *theXPathExpression, const char *theXPathExpressionEncoding, const char *theXML, int *theResult)
Evaluates an XPath expression.
XalanEvaluateXPathAsBoolean
XalanEvaluateXPathAsBoolean(XalanXPathEvaluatorHandle theXalanHandle, XalanXPathHandle theXPathHandle, const char *theXML, int *theResult)
Evaluates a compiled XPath instance.
XalanXPathAPITerminate
XalanXPathAPITerminate()
Terminate Xerces and the XPath API.
XalanXPathAPIInitialize
XalanXPathAPIInitialize()
Initialize Xerces and the XPath API.
XalanXPathHandle
void * XalanXPathHandle
Handle used to store the address of compiled XPath instance.
Definition: XPathCAPI.h:81
XalanDestroyXPathEvaluator
XalanDestroyXPathEvaluator(XalanXPathEvaluatorHandle theXalanHandle)
Destroy a XalanXPathEvaluator instance.
XalanCreateXPathEvaluator
XalanCreateXPathEvaluator(XalanXPathEvaluatorHandle *theHandle)
Create a XalanXPathEvaluator instance.
XALAN_XPATHCAPI_EXPORT_FUNCTION
#define XALAN_XPATHCAPI_EXPORT_FUNCTION(T)
Definition: XPathCAPI.h:40
XalanDestroyXPath
XalanDestroyXPath(XalanXPathEvaluatorHandle theXalanHandle, XalanXPathHandle theXPathHandle)
Destroys a compiled XPath instance.