SaxonC
11.6
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 () | |
A default constructor. More... | |
SaxonProcessor (const char *configFile) | |
constructor based upon a Saxon configuration file. More... | |
SaxonProcessor (bool l) | |
A constructor. More... | |
SaxonProcessor & | operator= (const SaxonProcessor &other) |
The copy assignment= operator. More... | |
SaxonProcessor (const SaxonProcessor &other) | |
SaxonProcessor copy constructor. More... | |
~SaxonProcessor () | |
Destructor method. At the end of the program call the release() method to clear the JVM. | |
const char * | getErrorMessage () |
Get any error message thrown by the processor. More... | |
DocumentBuilder * | newDocumentBuilder () |
Create a DocumentBuilder. More... | |
Xslt30Processor * | newXslt30Processor () |
Create an Xslt30Processor. More... | |
XQueryProcessor * | newXQueryProcessor () |
Create an XQueryProcessor. More... | |
XPathProcessor * | newXPathProcessor () |
Create an XPathProcessor. An XPathProcessor is used to compile XPath expressions. More... | |
SchemaValidator * | newSchemaValidator () |
Create a SchemaValidator which can be used to validate instance documents against the schema held by this SchemaManager. More... | |
XdmAtomicValue * | makeStringValue (std::string str) |
Factory method. Unlike the constructor, this avoids creating a new StringValue in the case. More... | |
XdmAtomicValue * | makeStringValue (const char *str) |
Factory method. Unlike the constructor, this avoids creating a new StringValue in the case. More... | |
XdmAtomicValue * | makeIntegerValue (int i) |
XdmAtomicValue * | makeDoubleValue (double d) |
Factory method. make an XdmAtomicValue from a primitive double value. More... | |
XdmAtomicValue * | makeFloatValue (float f) |
Factory method. make an XdmAtomicValue from a primitive float value. More... | |
XdmAtomicValue * | makeLongValue (long l) |
Factory method: makes either an Int64Value or a BigIntegerValue depending on the value supplied. More... | |
XdmAtomicValue * | makeBooleanValue (bool b) |
Factory method: makes a XdmAtomicValue representing a boolean Value. More... | |
XdmAtomicValue * | makeQNameValue (const char *str) |
Create an QName Xdm value from string representation in clark notation. More... | |
XdmAtomicValue * | makeAtomicValue (const char *type, const char *value) |
Create an Xdm Atomic value from string representation. More... | |
XdmArray * | makeArray (const char **input, int length) |
Make an XdmArray whose members are from string representation. More... | |
XdmArray * | makeArray (short *input, int length) |
Make an XdmArray whose members are xs:short values. More... | |
XdmArray * | makeArray (int *input, int length) |
Make an XdmArray whose members are xs:int values. More... | |
XdmArray * | makeArray (long *input, int length) |
Make an XdmArray whose members are xs:long values. More... | |
XdmArray * | makeArray (bool *input, int length) |
XdmArray * | makeArray (XdmValue **values, int length) |
Make an XdmArray whose members are of type XdmValue. More... | |
XdmMap * | makeMap (std::map< XdmAtomicValue *, XdmValue * > dataMap) |
Make an XdmMap whose argument is a map from the standard template library. More... | |
XdmMap * | makeMap3 (XdmAtomicValue **keys, XdmValue **values, int len) |
Make an XdmMap from an array of keys and values. More... | |
const char * | getStringValue (XdmItem *item) |
Get the string representation of the XdmValue. More... | |
XdmNode * | parseXmlFromString (const char *source, SchemaValidator *validator=nullptr) |
Parse a lexical representation of the source document and return it as an XdmNode. More... | |
XdmNode * | parseXmlFromFile (const char *source, SchemaValidator *validator=nullptr) |
Parse a source document file and return it as an XdmNode. More... | |
XdmNode * | parseXmlFromUri (const char *source, SchemaValidator *validator=nullptr) |
Parse a source document available by URI and return it as an XdmNode. More... | |
int | getNodeKind (jobject obj) |
Get the kind of node. More... | |
bool | isSchemaAwareProcessor () |
Test whether this processor is schema-aware. More... | |
bool | exceptionOccurred () |
Checks for thrown exceptions. More... | |
void | exceptionClear () |
Clears any exception that is currently being thrown. If no exception is currently being thrown, this routine has no effect. | |
XdmValue ** | createXdmValueArray (int len) |
Utility method for working with SaxonC on Python. | |
XdmAtomicValue ** | createXdmAtomicValueArray (int len) |
Utility method for working with SaxonC on Python. | |
void | setcwd (const char *cwd) |
Set the current working directory. | |
const char * | getcwd () |
Get the current working directory. More... | |
const char * | getResourcesDirectory () |
Get saxon resources directory. More... | |
void | setResourcesDirectory (const char *dir) |
set saxon resources directory | |
void | setCatalog (const char *catalogFile, bool isTracing) |
void | setConfigurationProperty (const char *name, const char *value) |
Set a configuration property specific to the processor in use. More... | |
void | clearConfigurationProperties () |
Clear configuration properties specific to the processor in use. | |
const char * | version () |
Get the Saxon version. More... | |
void | addNativeMethod (char *name, char *signature, void *fnPtr) |
Add a native method. More... | |
bool | registerCPPFunction (char *libName, JNINativeMethod *gMethods=nullptr) |
Register several native methods for one class. More... | |
SaxonApiException * | checkAndCreateException (jclass cppClass) |
Check for exception thrown in the underlying JNI. Then create the SaxonApiException class which the user can retrieve. More... | |
Static Public Member Functions | |
static XdmAtomicValue * | makeStringValue2 (std::string str) |
Factory method. Unlike the constructor, this avoids creating a new StringValue in the case. More... | |
static XdmMap * | makeMap2 (std::map< std::string, XdmValue * > dataMap) |
Make an XdmMap whose argument is a map from the standard template library. More... | |
static SaxonApiException * | checkForExceptionCPP (JNIEnv *env, jclass callingClass, jobject callingObject) |
Checks for pending exceptions and creates a SaxonApiException object, which handles one or more local exceptions objects. More... | |
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 a Java VM. | |
static void | detachCurrentThread () |
Detach JVM from the current thread. | |
static bool | registerNativeMethods (JNIEnv *env, const char *className, JNINativeMethod *gMethods, int numMethods) |
Register several native methods for one class. More... | |
static void | getInfo () |
Public Attributes | |
std::string | cwd |
jobject | proc |
Static Public Attributes | |
static int | jvmCreatedCPP = 0 |
static sxnc_environment * | sxn_environ = 0 |
Protected Attributes | |
jclass | xdmAtomicClass |
jclass | versionClass |
jclass | procClass |
jclass | saxonCAPIClass |
std::string | cwdV |
std::string | versionStr |
std::map< std::string, XdmValue * > | parameters |
std::map< std::string, std::string > | configProperties |
bool | licensei |
JNINativeMethod * | nativeMethods |
std::vector< JNINativeMethod > | nativeMethodVect |
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 used to create Xdm objects from primitive types.
SaxonProcessor::SaxonProcessor | ( | ) |
A default constructor.
Create Saxon Processor.
SaxonProcessor::SaxonProcessor | ( | const char * | configFile | ) |
constructor based upon a Saxon configuration file.
Create Saxon Processor.
SaxonProcessor::SaxonProcessor | ( | bool | l | ) |
A constructor.
Create Saxon Processor.
l | - Flag that a license is to be used. Default is false. |
SaxonProcessor::SaxonProcessor | ( | const SaxonProcessor & | other | ) |
SaxonProcessor copy constructor.
other | - SaxonProcessor |
|
inline |
Add a native method.
name | of the native method |
signature | of the native method |
fnPtr | Pointer to the native method |
SaxonApiException * SaxonProcessor::checkAndCreateException | ( | jclass | cppClass | ) |
Check for exception thrown in the underlying JNI. Then create the SaxonApiException class which the user can retrieve.
cppClass |
|
static |
Checks for pending exceptions and creates a SaxonApiException object, which handles one or more local exceptions objects.
env | |
callingClass | |
callingObject |
bool SaxonProcessor::exceptionOccurred | ( | ) |
Checks for thrown exceptions.
const char * SaxonProcessor::getcwd | ( | ) |
Get the current working directory.
const char * SaxonProcessor::getErrorMessage | ( | ) |
Get any error message thrown by the processor.
|
static |
Get info on objects allocated and still in memory
int SaxonProcessor::getNodeKind | ( | jobject | obj | ) |
Get the kind of node.
obj | - The Java object representation of the XdmNode |
const char * SaxonProcessor::getResourcesDirectory | ( | ) |
Get saxon resources directory.
const char * SaxonProcessor::getStringValue | ( | XdmItem * | item | ) |
bool SaxonProcessor::isSchemaAwareProcessor | ( | ) |
Test whether this processor is schema-aware.
XdmArray * SaxonProcessor::makeArray | ( | bool * | input, |
int | length | ||
) |
XdmArray * SaxonProcessor::makeArray | ( | const char ** | input, |
int | length | ||
) |
XdmArray * SaxonProcessor::makeArray | ( | int * | input, |
int | length | ||
) |
XdmArray * SaxonProcessor::makeArray | ( | long * | input, |
int | length | ||
) |
XdmArray * SaxonProcessor::makeArray | ( | short * | input, |
int | length | ||
) |
XdmAtomicValue * SaxonProcessor::makeAtomicValue | ( | const char * | type, |
const char * | value | ||
) |
Create an Xdm Atomic value from string representation.
type | - Local name of a type in the XML Schema namespace. |
value | - The value given in a string form. In the case of a QName the value supplied must be in clark notation. {uri}local |
XdmAtomicValue * SaxonProcessor::makeBooleanValue | ( | bool | b | ) |
Factory method: makes a XdmAtomicValue representing a boolean Value.
b | true or false, to determine which boolean value is required |
XdmAtomicValue * SaxonProcessor::makeDoubleValue | ( | double | d | ) |
Factory method. make an XdmAtomicValue from a primitive double value.
d | the value of the double |
XdmAtomicValue * SaxonProcessor::makeFloatValue | ( | float | f | ) |
Factory method. make an XdmAtomicValue from a primitive float value.
f | the value of the float |
XdmAtomicValue * SaxonProcessor::makeIntegerValue | ( | int | i | ) |
Factory method: makes either an Int64Value or a BigIntegerValue depending on the value supplied
i | the supplied primitive integer value |
XdmAtomicValue * SaxonProcessor::makeLongValue | ( | long | l | ) |
Factory method: makes either an Int64Value or a BigIntegerValue depending on the value supplied.
l | the supplied primitive long value |
XdmMap * SaxonProcessor::makeMap | ( | std::map< XdmAtomicValue *, XdmValue * > | dataMap | ) |
Make an XdmMap whose argument is a map from the standard template library.
dataMap | is std::map, which consists of keys as XdmAtomicValue and value is XdmValue. |
Make an XdmMap whose argument is a map from the standard template library.
dataMap | is std::map, which consists of keys as std::string and value is XdmValue. Keys are converted to XdmAtomicValue objects |
XdmMap * SaxonProcessor::makeMap3 | ( | XdmAtomicValue ** | keys, |
XdmValue ** | values, | ||
int | len | ||
) |
Make an XdmMap from an array of keys and values.
keys | - The keys are given as a pointer array of XdmAtomicValue |
values | - The values are given as a pointer array of XdmValue |
len | - The length of the arrays given as argument |
XdmAtomicValue * SaxonProcessor::makeQNameValue | ( | const char * | str | ) |
Create an QName Xdm value from string representation in clark notation.
str | - The value given in a string form in clark notation. {uri}local |
XdmAtomicValue * SaxonProcessor::makeStringValue | ( | const char * | str | ) |
Factory method. Unlike the constructor, this avoids creating a new StringValue in the case.
of a zero-length string (and potentially other strings, in future)
str | the char pointer array. nullptr is taken as equivalent to "". |
XdmAtomicValue * SaxonProcessor::makeStringValue | ( | std::string | str | ) |
Factory method. Unlike the constructor, this avoids creating a new StringValue in the case.
of a zero-length string (and potentially other strings, in future)
str | the String value. NULL is taken as equivalent to "". |
|
static |
Factory method. Unlike the constructor, this avoids creating a new StringValue in the case.
of a zero-length string (and potentially other strings, in future)
str | the std:string |
DocumentBuilder * SaxonProcessor::newDocumentBuilder | ( | ) |
Create a DocumentBuilder.
A DocumentBuilder is used to load source XML documents.
SchemaValidator * SaxonProcessor::newSchemaValidator | ( | ) |
Create a SchemaValidator which can be used to validate instance documents against the schema held by this SchemaManager.
XPathProcessor * SaxonProcessor::newXPathProcessor | ( | ) |
Create an XPathProcessor. An XPathProcessor is used to compile XPath expressions.
XQueryProcessor * SaxonProcessor::newXQueryProcessor | ( | ) |
Create an XQueryProcessor.
An XQueryProcessor is used to compile XQuery queries.
Xslt30Processor * SaxonProcessor::newXslt30Processor | ( | ) |
Create an Xslt30Processor.
An Xslt30Processor is used to compile XSLT30 stylesheets.
SaxonProcessor & SaxonProcessor::operator= | ( | const SaxonProcessor & | other | ) |
The copy assignment= operator.
Create a copy of the Saxon Processor.
other | - SaxonProcessor object |
XdmNode * SaxonProcessor::parseXmlFromFile | ( | const char * | source, |
SchemaValidator * | validator = nullptr |
||
) |
XdmNode * SaxonProcessor::parseXmlFromString | ( | const char * | source, |
SchemaValidator * | validator = nullptr |
||
) |
XdmNode * SaxonProcessor::parseXmlFromUri | ( | const char * | source, |
SchemaValidator * | validator = nullptr |
||
) |
|
inline |
Register several native methods for one class.
libName | name of the library which contains the function(s). Loads the library |
gMethods | Register native methods. Default is nullptr, also nullptr allowed in which cause assumption is made the user has added native methods using the method addNativeMethod . |
|
inlinestatic |
Register several native methods for one class.
env | |
className | |
gMethods | |
numMethods |
void SaxonProcessor::setCatalog | ( | const char * | catalogFile, |
bool | isTracing | ||
) |
set catalog to be used in Saxon
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 | of the property |
value | of the property |
Set a configuration property.
const char * SaxonProcessor::version | ( | ) |
Get the Saxon version.
|
protected |
map of properties used for the transformation as (string, string) pairs
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 |
indicates whether the Processor requires a Saxon that needs a license file (i.e. Saxon-EE) other a Saxon-HE Processor is created
|
protected |
native methods variable used in extension methods
|
protected |
Vector of native methods defined by user
|
protected |
map of parameters used for the transformation as (string, value) pairs
jobject SaxonProcessor::proc |
Java Processor object
|
protected |
The SAxon Processor instance
|
protected |
The SaxonCAPI instance
|
static |
Environment to captures the jni, JVM and handler to the cross compiled SaxonC library.
|
protected |
The Version instance
|
protected |
The Saxon version string
|
protected |
The XdmAtomicValue instance