Saxon/C
1.2.1
Saxon Processor library for C/C++, PHP and Python
|
#include <XQueryProcessor.h>
Public Member Functions | |
XQueryProcessor () | |
Default constructor. | |
XQueryProcessor (SaxonProcessor *p, std::string cwd="") | |
Constructor with the SaxonProcessor supplied. More... | |
void | setContextItem (XdmItem *value) |
Set the initial context item for the query. More... | |
void | setOutputFile (const char *outfile) |
void | setContextItemFromFile (const char *filename) |
void | setParameter (const char *name, XdmValue *value) |
bool | removeParameter (const char *name) |
void | setProperty (const char *name, const char *value) |
void | clearParameters (bool deleteValues=false) |
void | clearProperties () |
void | setUpdating (bool updating) |
void | executeQueryToFile (const char *infilename, const char *ofilename, const char *query) |
Perform the Query to file. More... | |
XdmValue * | executeQueryToValue (const char *infilename, const char *query) |
Perform the Query to a XdmValue representation. More... | |
const char * | executeQueryToString (const char *infilename, const char *query) |
Perform the Query to a string representation. More... | |
XdmValue * | runQueryToValue () |
Execute the Query cached. More... | |
const char * | runQueryToString () |
void | runQueryToFile () |
Execute the Query cached to file. More... | |
void | declareNamespace (const char *prefix, const char *uri) |
Declare a namespace binding. More... | |
std::map< std::string, XdmValue * > & | getParameters () |
Get all parameters as a std::map. More... | |
std::map< std::string, std::string > & | getProperties () |
Get all properties as a std::map. More... | |
void | setQueryFile (const char *filename) |
Compile a query supplied as a file name. More... | |
void | setQueryContent (const char *content) |
Compile a query supplied as a string. More... | |
void | setQueryBaseURI (const char *baseURI) |
Set the static base URI for the query. More... | |
void | setcwd (const char *cwd) |
const char * | checkException () |
Check for exception thrown. More... | |
bool | exceptionOccurred () |
void | exceptionClear () |
Clear any exception thrown. | |
int | exceptionCount () |
Get number of errors reported during execution of the query. More... | |
const char * | getErrorMessage (int i) |
Get the ith error message if there are any error. More... | |
const char * | getErrorCode (int i) |
Get the i'th error code if there are any error. More... | |
An XQueryProcessor
represents factory to compile, load and execute the query.
XQueryProcessor::XQueryProcessor | ( | SaxonProcessor * | p, |
std::string | cwd = "" |
||
) |
Constructor with the SaxonProcessor supplied.
SaxonProcessor | - Supplied pointer to the SaxonProcessor object |
cwd | - set the current working directory. Default is the empty string |
const char * XQueryProcessor::checkException | ( | ) |
Check for exception thrown.
void XQueryProcessor::clearParameters | ( | bool | deleteValues = false | ) |
Clear parameter values set
deleteValues. | Individual pointers to XdmValue objects have to be deleted in the calling program Default behaviour (false) is to leave XdmValues in memory true then XdmValues are deleted |
void XQueryProcessor::clearProperties | ( | ) |
Clear property values set
void XQueryProcessor::declareNamespace | ( | const char * | prefix, |
const char * | uri | ||
) |
Declare a namespace binding.
Declare a namespace binding as part of the static context for queries compiled using this XQueryCompiler. This binding may be overridden by a binding that appears in the query prolog. The namespace binding will form part of the static context of the query, but it will not be copied into result trees unless the prefix is actually used in an element or attribute name.
prefix | The namespace prefix. If the value is a zero-length string, this method sets the default namespace for elements and types. |
uri | The namespace URI. It is possible to specify a zero-length string to "undeclare" a namespace; in this case the prefix will not be available for use, except in the case where the prefix is also a zero length string, in which case the absence of a prefix implies that the name is in no namespace. Assume the prefix or uri is null. |
int XQueryProcessor::exceptionCount | ( | ) |
Get number of errors reported during execution of the query.
A transformation may have a number of errors reported against it.
bool XQueryProcessor::exceptionOccurred | ( | ) |
Checks for pending exceptions without creating a local reference to the exception object
void XQueryProcessor::executeQueryToFile | ( | const char * | infilename, |
const char * | ofilename, | ||
const char * | query | ||
) |
Perform the Query to file.
The result is is saved to file
infilename | - The file name of the source document |
ofilename | - The file name of where result will be stored |
query | - The query as string representation. TODO check |
const char * XQueryProcessor::executeQueryToString | ( | const char * | infilename, |
const char * | query | ||
) |
Perform the Query to a string representation.
infilename | - The file name of the source document |
query | - The query as string representation |
XdmValue * XQueryProcessor::executeQueryToValue | ( | const char * | infilename, |
const char * | query | ||
) |
const char * XQueryProcessor::getErrorCode | ( | int | i | ) |
Get the i'th error code if there are any error.
After the execution of the query there may be a number of errors reported against it.
const char * XQueryProcessor::getErrorMessage | ( | int | i | ) |
Get the ith error message if there are any error.
A transformation may have a number of errors reported against it.
std::map< std::string, XdmValue * > & XQueryProcessor::getParameters | ( | ) |
Get all parameters as a std::map.
std::map< std::string, std::string > & XQueryProcessor::getProperties | ( | ) |
Get all properties as a std::map.
bool XQueryProcessor::removeParameter | ( | const char * | name | ) |
Remove a parameter (name, value) pair
namespacei | currently not used |
name | of the parameter |
void XQueryProcessor::runQueryToFile | ( | ) |
Execute the Query cached to file.
The use of the context item would have had to be set in advance Assume the output filename has been set in advance
const char * XQueryProcessor::runQueryToString | ( | ) |
Execute the Query cached. The use of the context item would have had to be set in advance
XdmValue * XQueryProcessor::runQueryToValue | ( | ) |
Execute the Query cached.
The use of the context item would have had to be set in advance
void XQueryProcessor::setContextItem | ( | XdmItem * | value | ) |
Set the initial context item for the query.
value | - the initial context item, or null if there is to be no initial context item |
Set the source document for the query
void XQueryProcessor::setContextItemFromFile | ( | const char * | ifile | ) |
Set the source from file for the query.
Set the source document for the query
void XQueryProcessor::setcwd | ( | const char * | cwd | ) |
set the current working directory
void XQueryProcessor::setOutputFile | ( | const char * | ofile | ) |
Set the output file where the result is sent
void XQueryProcessor::setParameter | ( | const char * | name, |
XdmValue * | value | ||
) |
Set a parameter value used in the query s
name | of the parameter, as a string. For namespaced parameter use the JAXP solution i.e. "{uri}name" |
value | of the query parameter, or null to clear a previously set value |
Set a parameter value used in the query
name | of the parameter, as a string |
value | of the query parameter, or null to clear a previously set value |
void XQueryProcessor::setProperty | ( | const char * | name, |
const char * | value | ||
) |
Set a property specific to the processor in use. XQueryProcessor: set serialization properties (names start with '!' i.e. name "!method" -> "xml") 'o':outfile name, 's': source as file name 'q': query file name, 'q': current by name, 'qs': string form of the query, 'base': set the base URI of the query, 'dtd': set DTD validation 'on' or 'off'
name | of the property |
value | of the property |
Set a property.
name | of the property |
value | of the property |
void XQueryProcessor::setQueryBaseURI | ( | const char * | baseURI | ) |
Set the static base URI for the query.
baseURI | the static base URI; or null to indicate that no base URI is available |
void XQueryProcessor::setQueryContent | ( | const char * | content | ) |
Compile a query supplied as a string.
The supplied query is cached for later execution.
void XQueryProcessor::setQueryFile | ( | const char * | filename | ) |
Compile a query supplied as a file name.
The supplied query is cached for later execution.
void XQueryProcessor::setUpdating | ( | bool | updating | ) |
Say whether the query is allowed to be updating. XQuery update syntax will be rejected during query compilation unless this flag is set. XQuery Update is supported only under Saxon-EE.
updating | - true if the query is allowed to use the XQuery Update facility (requires Saxon-EE). If set to false, the query must not be an updating query. If set to true, it may be either an updating or a non-updating query. |