SaxonC 12.5
Saxon Processor library for C/C++, PHP and Python
|
#include <SaxonProcessor.h>
Public Member Functions | |
SaxonProcessor () | |
A default constructor. | |
SaxonProcessor (const char *configFile) | |
constructor based upon a Saxon configuration file. | |
SaxonProcessor (bool l) | |
A constructor. | |
SaxonProcessor & | operator= (const SaxonProcessor &other) |
The copy assignment= operator. | |
SaxonProcessor (const SaxonProcessor &other) | |
SaxonProcessor copy constructor. | |
~SaxonProcessor () | |
const char * | getErrorMessage () |
Get any error message thrown by the processor. | |
DocumentBuilder * | newDocumentBuilder () |
Create a DocumentBuilder. | |
Xslt30Processor * | newXslt30Processor () |
Create an Xslt30Processor. | |
XQueryProcessor * | newXQueryProcessor () |
Create an XQueryProcessor. | |
XPathProcessor * | newXPathProcessor () |
SchemaValidator * | newSchemaValidator () |
XdmAtomicValue * | makeStringValue (std::string str, const char *encoding=nullptr) |
XdmAtomicValue * | makeStringValue (const char *str, const char *encoding=nullptr) |
XdmAtomicValue * | makeIntegerValue (int i) |
XdmAtomicValue * | makeDoubleValue (double d) |
Factory method. make an XdmAtomicValue from a primitive double value. | |
XdmAtomicValue * | makeFloatValue (float f) |
Factory method. make an XdmAtomicValue from a primitive float value. | |
XdmAtomicValue * | makeLongValue (long l) |
XdmAtomicValue * | makeBooleanValue (bool b) |
Factory method: makes a XdmAtomicValue representing a boolean Value. | |
XdmAtomicValue * | makeQNameValue (const char *str) |
Create an QName Xdm value from string representation in clark notation. | |
XdmAtomicValue * | makeAtomicValue (const char *type, const char *value) |
Create an Xdm Atomic value from string representation. | |
XdmArray * | makeArray (const char **input, int length) |
Make an XdmArray whose members are from string representation. | |
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:int values. | |
XdmArray * | makeArray (long long *input, int length) |
Make an XdmArray whose members are xs:long values. | |
XdmArray * | makeArray (bool *input, int length) |
XdmArray * | makeArray (XdmValue **values, int length) |
Make an XdmArray whose members are of type XdmValue. | |
XdmMap * | makeMap (std::map< XdmAtomicValue *, XdmValue * > dataMap) |
Make an XdmMap whose argument is a map from the standard template library. | |
XdmMap * | makeMap3 (XdmAtomicValue **keys, XdmValue **values, int len) |
Make an XdmMap from an array of keys and values. | |
const char * | clarkNameToEQName (const char *name) |
Convert clark name string to EQName notation. | |
const char * | EQNameToClarkName (const char *name) |
Convert EQName string to clark name notation. | |
const char * | getStringValue (XdmItem *item) |
Get the string representation of the XdmValue. | |
XdmNode * | parseXmlFromString (const char *source, const char *encoding=nullptr, SchemaValidator *validator=nullptr) |
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) |
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. | |
bool | isSchemaAwareProcessor () |
Test whether this processor is schema-aware. | |
bool | exceptionOccurred () |
Checks for thrown exceptions. | |
void | exceptionClear () |
XdmValue ** | createXdmValueArray (int len) |
Utility method for working with SaxonC on Python. | |
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. | |
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 saxon resources directory. | |
void | setResourcesDirectory (const char *dir) |
set saxon resources directory | |
void | setCatalog (const char *catalogFile) |
void | setCatalogFiles (const char **catalogFiles, int length) |
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. | |
const char * | version () |
Get the Saxon version. | |
void | createHeapDump (bool live) |
Internal method for diagnostics. | |
Static Public Member Functions | |
static XdmMap * | makeMap2 (std::map< std::string, XdmValue * > dataMap) |
Make an XdmMap whose argument is a map from the standard template library. | |
static SaxonApiException * | checkForExceptionCPP () |
static void | release () |
static void | attachCurrentThread () |
Attaches a current thread to the a Java VM. | |
static void | detachCurrentThread () |
Detach JVM from the current thread. | |
static void | deleteString (const char *data, char deleteFlag=0) |
static void | getInfo () |
Public Attributes | |
std::string | cwd |
Static Public Attributes | |
static int | jvmCreatedCPP = 0 |
Add a native method. | |
static sxnc_environment * | sxn_environ = 0 |
Protected Attributes | |
std::string | cwdV |
std::string | versionStr |
std::map< std::string, XdmValue * > | parameters |
std::map< std::string, std::string > | configProperties |
bool | licensei |
int64_t | procRef |
ObjectHandle reference to the underlying processor. | |
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 | ( | ) |
SaxonProcessor::SaxonProcessor | ( | const char * | configFile | ) |
constructor based upon a Saxon configuration file.
Create Saxon Processor.
SaxonApiException |
SaxonProcessor::SaxonProcessor | ( | bool | l | ) |
A constructor.
Create 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 |
SaxonProcessor::~SaxonProcessor | ( | ) |
Destructor method. At the end of the program call the release() method to clear the JVM.
|
static |
Checks for pending exceptions and creates a SaxonApiException object, which handles one or more local exceptions objects
const char * SaxonProcessor::clarkNameToEQName | ( | const char * | name | ) |
Convert clark name string to EQName notation.
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 URI in Clark notation: {uri}local if the name is in a namespace, or simply local if not. |
|
inlinestatic |
Utility method required for python and PHP extension to delete string created in the C++ code-base
data | - the string data to be deleted using the operator delete |
deleteFlag | - this is a special case to handle the empty sequence which returns empty string there has not allowed any memory |
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 EQName string to clark name notation.
name | - The URI 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. |
void SaxonProcessor::exceptionClear | ( | ) |
Clears any exception that is currently being thrown. If no exception is currently being thrown, this routine has no effect.
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 | ( | int64_t | 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 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, |
const char * | encoding = nullptr ) |
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 "". |
encoding | - the encoding of the string. If not specified then the platform default encoding is used. |
XdmAtomicValue * SaxonProcessor::makeStringValue | ( | std::string | str, |
const char * | encoding = nullptr ) |
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 "". |
encoding | - the encoding of the string. If not specified then the platform default encoding is used. |
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 |
XdmValue * SaxonProcessor::parseJsonFromFile | ( | const char * | source | ) |
Parse a source JSON file and return it as an XdmValue.
source | the filename of the JSON. This is a full path filename or a URI |
SaxonApiException | if there ia a failure in the parsing of the XML file |
XdmValue * SaxonProcessor::parseJsonFromString | ( | const char * | source, |
const char * | encoding = NULL ) |
Parse a lexical representation of the JSON and return it as an XdmValue
source | the JSON as a lexical string |
encoding | the encoding of the source argument. Argument can be omitted and NULL accepted to use the default platform encoding |
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 |
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 the source 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 |
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 |
SaxonApiException | if there ia failure in the parsing of the XML file |
|
static |
Clean up and destroy Java VM to release memory used. Method to be called at the end of the program
void SaxonProcessor::setCatalog | ( | const char * | catalogFile | ) |
set catalog to be used in Saxon
catalogFile | file name to the catalog |
SaxonApiException | if fail to set the catalog file |
void SaxonProcessor::setCatalogFiles | ( | const char ** | catalogFiles, |
int | length ) |
set catalog files to be used in Saxon
catalogFiles | - the catalog file names array to the catalog |
length | - number of catalog files in the array argument |
SaxonApiException | if fail to set the catalog file |
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 |
Add a native method.
name | of the native method |
signature | of the native method |
fnPtr | Pointer to the native method 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 . |
env | |
className | |
gMethods | |
numMethods |
cppClass |
|
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 |
map of parameters used for the transformation as (string, value) pairs
|
static |
Environment to captures the jni, JVM and handler to the cross compiled SaxonC library.
|
protected |
The Saxon version string