![]() |
SaxonC 12.7.0
Saxon Processor library for C/C++, PHP and Python
|
The SaxonProcessor
class acts as a factory for generating XQuery, XPath, Schema and XSLT compilers.
More...
#include <SaxonProcessor.h>
Public Member Functions | |
SaxonProcessor () | |
Default constructor. | |
SaxonProcessor (const char *configFile) | |
Constructor based upon a Saxon configuration file. | |
SaxonProcessor (bool l) | |
Constructor. | |
SaxonProcessor & | operator= (const SaxonProcessor &other) |
The copy assignment= operator. | |
SaxonProcessor (const SaxonProcessor &other) | |
SaxonProcessor copy constructor. | |
~SaxonProcessor () | |
Destructor method: at the end of the program call the release() method to clear the JVM. | |
const char * | getErrorMessage () |
Deprecated. | |
DocumentBuilder * | newDocumentBuilder () |
Create a DocumentBuilder. | |
Xslt30Processor * | newXslt30Processor () |
Create an Xslt30Processor. | |
XQueryProcessor * | newXQueryProcessor () |
Create an XQueryProcessor. | |
XPathProcessor * | newXPathProcessor () |
Create an XPathProcessor. | |
SchemaValidator * | newSchemaValidator () |
Create a SchemaValidator. | |
void | setExtensionLibrary (const char *libraryName) |
XdmAtomicValue * | makeStringValue (std::string str, const char *encoding=nullptr) |
Factory method to create an xs:string atomic value as a new XdmAtomicValue. | |
XdmAtomicValue * | makeStringValue (const char *str, const char *encoding=nullptr) |
Factory method to create an xs:string atomic value as a new XdmAtomicValue. | |
XdmAtomicValue * | makeIntegerValue (int i) |
Factory method to create an xs:integer atomic value as a new XdmAtomicValue. | |
XdmAtomicValue * | makeDoubleValue (double d) |
Factory method to create an xs:double atomic value as a new XdmAtomicValue. | |
XdmAtomicValue * | makeFloatValue (float f) |
Factory method to create an xs:float atomic value as a new XdmAtomicValue. | |
XdmAtomicValue * | makeLongValue (long l) |
Factory method to create an xs:long atomic value as a new XdmAtomicValue. | |
XdmAtomicValue * | makeBooleanValue (bool b) |
Factory method to create an xs:boolean atomic value as a new XdmAtomicValue. | |
XdmAtomicValue * | makeQNameValue (const char *str) |
Create an xs:QName atomic value, from the string representation in clark notation. | |
XdmAtomicValue * | makeAtomicValue (const char *type, const char *value) |
Create an XDM atomic value from its lexical representation and the name of the required built-in atomic type. | |
XdmArray * | makeArray (char **input, int length) |
Make an XdmArray whose members are xs:string values. | |
XdmArray * | makeArray (short *input, int length) |
Make an XdmArray whose members are xs:short values. | |
XdmArray * | makeArray (int *input, int length) |
Make an XdmArray whose members are xs:integer values. | |
XdmArray * | makeArray (long long *input, int length) |
Make an XdmArray whose members are xs:long values. | |
XdmArray * | makeArray (bool *input, int length) |
Make an XdmArray whose members are xs:boolean values. | |
XdmArray * | makeArray (XdmValue **values, int length) |
Make an XdmArray by supplying an array of XdmValue pointers. | |
XdmMap * | makeMap (std::map< XdmAtomicValue *, XdmValue * > dataMap) |
Make an XdmMap by supplying a map from the standard template library, with keys in XDM form. | |
XdmMap * | makeMap3 (XdmAtomicValue **keys, XdmValue **values, int len) |
Make an XdmMap from arrays of keys and values in XDM form. | |
const char * | clarkNameToEQName (const char *name) |
Convert a string representing a QName value in clark notation to a string representing the QName in EQName notation. | |
const char * | EQNameToClarkName (const char *name) |
Convert a string representing a QName value in EQName notation to a string representing the QName in clark notation. | |
const char * | getStringValue (XdmItem *item) |
Get the string representation of an XdmItem. | |
XdmNode * | parseXmlFromString (const char *source, const char *encoding=nullptr, SchemaValidator *validator=nullptr) |
Parse a lexical representation of a source XML document and return it as an XdmNode. | |
XdmNode * | parseXmlFromFile (const char *source, SchemaValidator *validator=nullptr) |
Parse a source document file and return it as an XdmNode. | |
XdmNode * | parseXmlFromUri (const char *source, SchemaValidator *validator=nullptr) |
Parse a source document available by URI and return it as an XdmNode. | |
XdmValue * | parseJsonFromString (const char *source, const char *encoding=NULL) |
Parse a lexical representation of a source JSON document and return it as an XdmValue. | |
XdmValue * | parseJsonFromFile (const char *source) |
Parse a source JSON file and return it as an XdmValue. | |
int | getNodeKind (int64_t obj) |
Get the kind of node - internal use only. | |
bool | isSchemaAwareProcessor () |
Test whether this processor is schema-aware. | |
bool | exceptionOccurred () |
Deprecated. | |
void | exceptionClear () |
Deprecated. | |
XdmValue ** | createXdmValueArray (int len) |
Utility method for working with SaxonC on Python - internal use only. | |
void | deleteXdmValueArray (XdmValue **arr, int len) |
Utility method for Python API - internal use only. | |
XdmAtomicValue ** | createXdmAtomicValueArray (int len) |
Utility method for working with SaxonC on Python - internal use only. | |
void | deleteXdmAtomicValueArray (XdmAtomicValue **arr, int len) |
Utility method for Python API - internal use only. | |
void | setcwd (const char *cwd) |
Set the current working directory. | |
const char * | getcwd () |
Get the current working directory. | |
const char * | getResourcesDirectory () |
Get the saxon resources directory. | |
void | setResourcesDirectory (const char *dir) |
Set the saxon resources directory. | |
void | setCatalog (const char *catalogFile) |
Deprecated. | |
void | setCatalogFiles (const char **catalogFiles, int length) |
Set catalog files to be used in Saxon. | |
void | setConfigurationProperty (const char *name, const char *value) |
Set a configuration property specific to the processor in use. | |
void | clearConfigurationProperties () |
Clear configuration properties specific to the processor in use. | |
bool | isLicensed () |
Test whether a license key has been found and accepted. | |
const char * | getSaxonEdition () |
Get the short name of the licensed Saxon product edition, for example "EE". | |
const char * | version () |
Get the Saxon version. | |
void | createHeapDump (bool live) |
Internal method for diagnostics. | |
Static Public Member Functions | |
static void * | makeInternalArray (void **inputs, int length) |
static XdmMap * | makeMap2 (std::map< std::string, XdmValue * > dataMap) |
Make an XdmMap by supplying a map from the standard template library, with keys in primitive form. | |
static SaxonApiException * | checkForExceptionCPP () |
Deprecated. | |
static const char * | encodeString (const char *stringValue, const char *toCharSetName) |
static void | release () |
Clean up and destroy Java VM to release memory used; method to be called at the end of the program. | |
static void | attachCurrentThread () |
Attaches a current thread to the Java VM. | |
static void | detachCurrentThread () |
Detach JVM from the current thread. | |
static void | deleteString (const char *data) |
Utility method required for the python and PHP extensions to delete a string created in the C++ code-base. | |
Public Attributes | |
std::string | cwd |
Static Public Attributes | |
static int | jvmCreatedCPP = 0 |
static sxnc_environment * | sxn_environ = 0 |
Protected Attributes | |
std::string | cwdV |
std::string | versionStr |
std::map< std::string, XdmValue * > | parameters |
bool | licensei |
int64_t | procRef |
SaxonApiException * | exception |
The SaxonProcessor
class acts as a factory for generating XQuery, XPath, Schema and XSLT compilers.
The SaxonProcessor
class not only generates XQuery, XPath, Schema and XSLT Processors, but is also used to create XDM values from primitive types.
SaxonProcessor::SaxonProcessor | ( | ) |
SaxonProcessor::SaxonProcessor | ( | const char * | configFile | ) |
Constructor based upon a Saxon configuration file.
Creates a Saxon processor.
SaxonApiException |
SaxonProcessor::SaxonProcessor | ( | bool | l | ) |
Constructor.
Creates a Saxon processor.
l | - flag that a license is to be used. Default is false. |
SaxonApiException |
SaxonProcessor::SaxonProcessor | ( | const SaxonProcessor & | other | ) |
SaxonProcessor copy constructor.
other | - SaxonProcessor |
|
static |
Deprecated.
Checks for pending exceptions and creates a SaxonApiException object.
const char * SaxonProcessor::clarkNameToEQName | ( | const char * | name | ) |
Convert a string representing a QName value in clark notation to a string representing the QName in EQName notation.
Returns the expanded name, as a string using the notation defined by the EQName production in XPath 3.0. If the name is in a namespace, the resulting string takes the form Q{uri}local
. Otherwise, the value is the local part of the name.
name | - the QName in Clark notation: {uri}local if the name is in a namespace, or simply local if not. |
operator delete
.
|
inlinestatic |
Utility method required for the python and PHP extensions to delete a string created in the C++ code-base.
data | - the string data to be deleted using the operator delete |
void SaxonProcessor::deleteXdmAtomicValueArray | ( | XdmAtomicValue ** | arr, |
int | len ) |
Utility method for Python API - internal use only.
This method deletes a XdmAtomicValue pointer array.
arr | - XdmAtomicValue pointer array |
len | - length of the array |
void SaxonProcessor::deleteXdmValueArray | ( | XdmValue ** | arr, |
int | len ) |
const char * SaxonProcessor::EQNameToClarkName | ( | const char * | name | ) |
Convert a string representing a QName value in EQName notation to a string representing the QName in clark notation.
name | - the QName in EQName notation: Q{uri}local if the name is in a namespace. For a name in no namespace, either of the forms Q{}local or simply local are accepted. |
operator delete
. void SaxonProcessor::exceptionClear | ( | ) |
Deprecated.
Clears any exception that is currently being thrown. If no exception is currently being thrown, this routine has no effect.
bool SaxonProcessor::exceptionOccurred | ( | ) |
Deprecated.
Checks for thrown exceptions.
const char * SaxonProcessor::getcwd | ( | ) |
Get the current working directory.
const char * SaxonProcessor::getErrorMessage | ( | ) |
Deprecated.
Get any error message thrown by the processor.
int SaxonProcessor::getNodeKind | ( | int64_t | obj | ) |
Get the kind of node - internal use only.
obj | - the Java object representation of the XdmNode |
const char * SaxonProcessor::getResourcesDirectory | ( | ) |
Get the saxon resources directory.
delete
. const char * SaxonProcessor::getSaxonEdition | ( | ) |
Get the short name of the licensed Saxon product edition, for example "EE".
This represents the kind of configuration that has been created, rather than the software that has been installed; which depends on the license key supplied, as well as the software edition installed. For example it is possible to instantiate an "HE" configuration even when using the "PE" or "EE" software.
const char * SaxonProcessor::getStringValue | ( | XdmItem * | item | ) |
bool SaxonProcessor::isLicensed | ( | ) |
Test whether a license key has been found and accepted.
bool SaxonProcessor::isSchemaAwareProcessor | ( | ) |
Test whether this processor is schema-aware.
XdmArray * SaxonProcessor::makeArray | ( | bool * | input, |
int | length ) |
Make an XdmArray whose members are xs:boolean values.
input | - the input array of boolean values |
length | - the number of items in the array |
delete
. XdmArray * SaxonProcessor::makeArray | ( | char ** | input, |
int | length ) |
Make an XdmArray whose members are xs:string values.
input | - the input array of strings |
length | - the number of items in the array |
delete
. XdmArray * SaxonProcessor::makeArray | ( | int * | input, |
int | length ) |
Make an XdmArray whose members are xs:integer values.
input | - the input array of int values |
length | - the number of items in the array |
delete
. XdmArray * SaxonProcessor::makeArray | ( | long long * | input, |
int | length ) |
Make an XdmArray whose members are xs:long values.
input | - the input array of long values |
length | - the number of items in the array |
delete
. XdmArray * SaxonProcessor::makeArray | ( | short * | input, |
int | length ) |
Make an XdmArray whose members are xs:short values.
input | - the input array of short values |
length | - the number of items in the array |
delete
. XdmAtomicValue * SaxonProcessor::makeAtomicValue | ( | const char * | type, |
const char * | value ) |
Create an XDM atomic value from its lexical representation and the name of the required built-in atomic type.
type | - the local name of a type in the XML Schema namespace. |
value | - the atomic value given in a string form. In the case of a QName the value supplied must be in clark notation: {uri}local |
delete
. XdmAtomicValue * SaxonProcessor::makeBooleanValue | ( | bool | b | ) |
Factory method to create an xs:boolean
atomic value as a new XdmAtomicValue.
b | - the xs:boolean value as a boolean, true or false |
delete
. XdmAtomicValue * SaxonProcessor::makeDoubleValue | ( | double | d | ) |
Factory method to create an xs:double
atomic value as a new XdmAtomicValue.
d | - the xs:double value as a double |
delete
. XdmAtomicValue * SaxonProcessor::makeFloatValue | ( | float | f | ) |
Factory method to create an xs:float
atomic value as a new XdmAtomicValue.
f | - the xs:float value as a float |
delete
. XdmAtomicValue * SaxonProcessor::makeIntegerValue | ( | int | i | ) |
Factory method to create an xs:integer
atomic value as a new XdmAtomicValue.
Internally represented by either a Java Int64Value or a BigIntegerValue depending on the value supplied.
i | - the xs:integer value as an int |
delete
. XdmAtomicValue * SaxonProcessor::makeLongValue | ( | long | l | ) |
Factory method to create an xs:long
atomic value as a new XdmAtomicValue.
Internally represented by either a Java Int64Value or a BigIntegerValue depending on the value supplied.
l | - the xs:integer value as a long |
delete
. XdmMap * SaxonProcessor::makeMap | ( | std::map< XdmAtomicValue *, XdmValue * > | dataMap | ) |
Make an XdmMap by supplying a map from the standard template library, with keys in XDM form.
dataMap | - the input map as an std::map, which consists of keys as XdmAtomicValue and values as XdmValue. |
delete
. Make an XdmMap by supplying a map from the standard template library, with keys in primitive form.
dataMap | - the input map as an std::map, which consists of keys as std::string and values as XdmValue. Keys are converted to XdmAtomicValue objects |
delete
. XdmMap * SaxonProcessor::makeMap3 | ( | XdmAtomicValue ** | keys, |
XdmValue ** | values, | ||
int | len ) |
Make an XdmMap from arrays of keys and values in XDM form.
keys | - the keys are given as a pointer array of XdmAtomicValue |
values | - the values are given as a pointer array of XdmValue |
len | - the number of items in the arrays |
delete
. XdmAtomicValue * SaxonProcessor::makeQNameValue | ( | const char * | str | ) |
Create an xs:QName
atomic value, from the string representation in clark notation.
str | - the QName value given in a string form in clark notation: {uri}local |
delete
. XdmAtomicValue * SaxonProcessor::makeStringValue | ( | const char * | str, |
const char * | encoding = nullptr ) |
Factory method to create an xs:string
atomic value as a new XdmAtomicValue.
str | - the xs:string value as a char pointer array. nullptr is taken as equivalent to "". |
encoding | - the encoding of the string. If not specified then the platform default encoding is used. |
delete
. XdmAtomicValue * SaxonProcessor::makeStringValue | ( | std::string | str, |
const char * | encoding = nullptr ) |
Factory method to create an xs:string
atomic value as a new XdmAtomicValue.
str | - the xs:string value as a string. NULL is taken as equivalent to "". |
encoding | - the encoding of the string. If not specified then the platform default encoding is used. |
delete
. DocumentBuilder * SaxonProcessor::newDocumentBuilder | ( | ) |
Create a DocumentBuilder.
A DocumentBuilder is used to load source XML documents.
delete
. SchemaValidator * SaxonProcessor::newSchemaValidator | ( | ) |
Create a SchemaValidator.
A SchemaValidator can be used to validate instance documents against the schema held by this SchemaValidator.
delete
. XPathProcessor * SaxonProcessor::newXPathProcessor | ( | ) |
Create an XPathProcessor.
An XPathProcessor is used to compile XPath expressions.
delete
. XQueryProcessor * SaxonProcessor::newXQueryProcessor | ( | ) |
Create an XQueryProcessor.
An XQueryProcessor is used to compile XQuery queries.
delete
. Xslt30Processor * SaxonProcessor::newXslt30Processor | ( | ) |
Create an Xslt30Processor.
An Xslt30Processor is used to compile XSLT 3.0 stylesheets.
delete
. SaxonProcessor & SaxonProcessor::operator= | ( | const SaxonProcessor & | other | ) |
The copy assignment= operator.
Creates a copy of the Saxon processor.
other | - SaxonProcessor object |
XdmValue * SaxonProcessor::parseJsonFromFile | ( | const char * | source | ) |
Parse a source JSON file and return it as an XdmValue.
source | - the filename of the JSON document. This is a full path filename or a URI |
delete
. SaxonApiException | if there is a failure in the parsing of the JSON file |
XdmValue * SaxonProcessor::parseJsonFromString | ( | const char * | source, |
const char * | encoding = NULL ) |
Parse a lexical representation of a source JSON document and return it as an XdmValue.
source | - the JSON document as a lexical string |
encoding | - the encoding of the source argument. Argument can be omitted and NULL accepted to use the default platform encoding. |
delete
. SaxonApiException | if there is a failure in the parsing of the JSON |
XdmNode * SaxonProcessor::parseXmlFromFile | ( | const char * | source, |
SchemaValidator * | validator = nullptr ) |
Parse a source document file and return it as an XdmNode.
source | - the filename of the source document |
validator | - can be used to supply a SchemaValidator to validate the document. Default is null. |
delete
. SaxonApiException | if there ia a failure in the parsing of the XML file |
XdmNode * SaxonProcessor::parseXmlFromString | ( | const char * | source, |
const char * | encoding = nullptr, | ||
SchemaValidator * | validator = nullptr ) |
Parse a lexical representation of a source XML document and return it as an XdmNode.
source | - the source document as a lexical string |
encoding | - the encoding used to decode the source string. If not specified then platform default encoding is used. |
validator | - can be used to supply a SchemaValidator to validate the document. Default is null. |
delete
. SaxonApiException | if there is a failure in the parsing of the XML document |
XdmNode * SaxonProcessor::parseXmlFromUri | ( | const char * | source, |
SchemaValidator * | validator = nullptr ) |
Parse a source document available by URI and return it as an XdmNode.
source | - the URI of the source document |
validator | - can be used to supply a SchemaValidator to validate the document. Default is null. |
delete
. SaxonApiException | if there ia failure in the parsing of the XML file |
void SaxonProcessor::setCatalog | ( | const char * | catalogFile | ) |
Deprecated.
Set a catalog file to be used in Saxon.
catalogFile | - file name to the catalog |
SaxonApiException | if there is a failure to set the catalog file |
void SaxonProcessor::setCatalogFiles | ( | const char ** | catalogFiles, |
int | length ) |
Set catalog files to be used in Saxon.
catalogFiles | - array of the catalog file names |
length | - number of catalog files in the array argument |
SaxonApiException | if there is a failure to set the catalog files |
void SaxonProcessor::setConfigurationProperty | ( | const char * | name, |
const char * | value ) |
Set a configuration property specific to the processor in use.
Properties specified here are common across all the processors. Example 'l':enable line number has the value 'on' or 'off'
name | - the name of the property |
value | - the value for the property |
void SaxonProcessor::setcwd | ( | const char * | cwd | ) |
Set the current working directory.
cwd | - current working directory |
void SaxonProcessor::setResourcesDirectory | ( | const char * | dir | ) |
Set the saxon resources directory.
dir | - resources directory |
const char * SaxonProcessor::version | ( | ) |
Get the Saxon version.
std::string SaxonProcessor::cwd |
Current working directory
|
protected |
Current working directory
|
protected |
SaxonApiException object to capture exceptions thrown from the underlying Java code via JNI
|
static |
Flag to indicate JVM created - used in memory management
|
protected |
If true, this indicates that the Processor created needs a license file (i.e. Saxon-EE), otherwise a Saxon-HE Processor is created
|
protected |
Map of parameters used for the transformation as (string, value) pairs
|
protected |
ObjectHandle reference to the underlying processor
|
static |
Environment to capture the JNI, JVM and handler to the cross compiled SaxonC library.
|
protected |
The Saxon version string