SaxonC 12.2
Saxon Processor library for C/C++, PHP and Python
Loading...
Searching...
No Matches
XQueryProcessor.h
1
2// Copyright (c) 2022 - 2023 Saxonica Liimited.
3// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5// This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
7
8#ifndef SAXON_XQUERY_H
9#define SAXON_XQUERY_H
10
11
12
13#include "SaxonProcessor.h"
14#include <string>
15
16
17
18class SaxonProcessor;
20class XdmValue;
21class XdmItem;
22
27public:
28
31
33
37 XQueryProcessor(SaxonProcessor *p, std::string cwd="");
38
43 XQueryProcessor(const XQueryProcessor &other);
44
49
51
53
56 void setContextItem(XdmItem * value);
57
61 void setOutputFile(const char* outfile);
62
66 void setContextItemFromFile(const char * filename);
67
74 void setParameter(const char * name, XdmValue*value);
75
77
82 void setLanguageVersion(const char * version);
83
85
91 void setStreaming(bool option);
92
94
101 bool isStreaming();
102
103
105
110 bool removeParameter(const char * name);
111
113
121 void setProperty(const char * name, const char * value);
122
124
129 void clearParameters(bool deleteValues=false);
130
132 void clearProperties();
133
134
136
143 void setUpdating(bool updating);
144
145
147
155 void executeQueryToFile(const char * infilename, const char * ofilename, const char * query);
156
158
164 XdmValue * executeQueryToValue(const char * infilename, const char * query);
165
166
168
174 const char * executeQueryToString(const char * infilename, const char * query);
175
177
184
192 const char * runQueryToString();
193
194
196
202 void runQueryToFile();
203
205
219 void declareNamespace(const char *prefix, const char * uri);
220
221
223
226 std::map<std::string,XdmValue*>& getParameters();
227
229
232 std::map<std::string,std::string>& getProperties();
233
235
238 void setQueryFile(const char* filename);
239
241
244 void setQueryContent(const char* content);
245
247
250 void setQueryBaseURI(const char * baseURI);
251
255 void setcwd(const char* cwd);
256
257
259
262 const char* checkException();
263
268 bool exceptionOccurred();
269
271 void exceptionClear();
272
273
275
279 const char * getErrorMessage();
280
281
283
287 const char * getErrorCode();
288
290
296
297
298private:
299
300 void createException(const char * message=nullptr);
301 bool streaming;
302 std::string cwdXQ;
303 SaxonProcessor * proc;
304
305 int64_t cppXQ;
306 std::map<std::string,XdmValue*> parameters;
307 std::map<std::string,std::string> properties;
308 SaxonApiException * exception;
309};
310
311#endif /* SAXON_XQUERY_H */
Definition: SaxonApiException.h:21
The SaxonProcessor class acts as a factory for generating XQuery, XPath, Schema and XSLT compilers.
Definition: SaxonProcessor.h:110
Definition: XQueryProcessor.h:26
void setOutputFile(const char *outfile)
Definition: XQueryProcessor.cpp:144
void setcwd(const char *cwd)
Definition: XQueryProcessor.cpp:212
void setQueryBaseURI(const char *baseURI)
Set the static base URI for the query.
Definition: XQueryProcessor.cpp:218
void clearParameters(bool deleteValues=false)
Clear parameter values set.
Definition: XQueryProcessor.cpp:190
void setQueryFile(const char *filename)
Compile a query supplied as a file name.
Definition: XQueryProcessor.cpp:325
const char * checkException()
Check for exception thrown.
Definition: XQueryProcessor.cpp:379
void setStreaming(bool option)
Say whether the query should be compiled and evaluated to use streaming.
Definition: XQueryProcessor.cpp:330
bool exceptionOccurred()
Definition: XQueryProcessor.cpp:364
void setParameter(const char *name, XdmValue *value)
Definition: XQueryProcessor.cpp:151
void runQueryToFile()
Execute the Query cached to file.
Definition: XQueryProcessor.cpp:321
const char * getErrorCode()
Get the first error code if there are any errors.
Definition: XQueryProcessor.cpp:369
void executeQueryToFile(const char *infilename, const char *ofilename, const char *query)
Perform the Query to file.
Definition: XQueryProcessor.cpp:233
void declareNamespace(const char *prefix, const char *uri)
Declare a namespace binding.
Definition: XQueryProcessor.cpp:112
void setContextItem(XdmItem *value)
Set the initial context item for the query.
Definition: XQueryProcessor.cpp:104
XdmValue * runQueryToValue()
Execute the Query cached.
Definition: XQueryProcessor.cpp:317
std::map< std::string, std::string > & getProperties()
Get all properties as a std::map.
Definition: XQueryProcessor.cpp:95
void clearProperties()
Clear property values set.
Definition: XQueryProcessor.cpp:206
void exceptionClear()
Clear any exception thrown.
Definition: XQueryProcessor.cpp:355
void setLanguageVersion(const char *version)
Set XQuery language version.
Definition: XQueryProcessor.cpp:343
void setProperty(const char *name, const char *value)
Set a property specific to the processor in use.
Definition: XQueryProcessor.cpp:176
void setUpdating(bool updating)
Say whether the query is allowed to be updating.
Definition: XQueryProcessor.cpp:223
const char * runQueryToString()
Definition: XQueryProcessor.cpp:311
std::map< std::string, XdmValue * > & getParameters()
Get all parameters as a std::map.
Definition: XQueryProcessor.cpp:90
XdmValue * executeQueryToValue(const char *infilename, const char *query)
Perform the Query to a XdmValue representation.
Definition: XQueryProcessor.cpp:258
void setContextItemFromFile(const char *filename)
Definition: XQueryProcessor.cpp:137
void setQueryContent(const char *content)
Compile a query supplied as a string.
Definition: XQueryProcessor.cpp:348
bool isStreaming()
Ask whether the streaming option has been set.
Definition: XQueryProcessor.cpp:339
bool removeParameter(const char *name)
Remove a parameter (name, value) pair.
Definition: XQueryProcessor.cpp:170
const char * getErrorMessage()
Get the first error message if there are any errors.
Definition: XQueryProcessor.cpp:374
SaxonApiException * getException()
Get the SaxonApiException object created when we have an error.
Definition: XQueryProcessor.cpp:389
XQueryProcessor()
Default constructor.
Definition: XQueryProcessor.cpp:15
XQueryProcessor * clone()
Definition: XQueryProcessor.cpp:82
const char * executeQueryToString(const char *infilename, const char *query)
Perform the Query to a string representation.
Definition: XQueryProcessor.cpp:285
Definition: XdmItem.h:29
Definition: XdmValue.h:51