SaxonC 12.4
Saxon Processor library for C/C++, PHP and Python
Loading...
Searching...
No Matches
Functions
SaxonCXPath.h File Reference

SaxonCXPath.h provides the C API for XPath processing. This file contains a set of functions to compile and execute XPath expressions. More...

#include "SaxonCProcessor.h"

Go to the source code of this file.

Functions

int64_t booleanValue (sxnc_environment *environi, bool)
 
int64_t integerValue (sxnc_environment *environi, int i)
 
int64_t doubleValue (sxnc_environment *environi, double d)
 
int64_t floatValue (sxnc_environment *environi, float f)
 
int64_t longValue (sxnc_environment *environi, long l)
 
int64_t getJavaStringValue (sxnc_environment *environi, const char *str)
 
int64_t xdmValueAsObj (sxnc_environment *environi, const char *type, const char *str)
 
sxnc_valuexdmValue (sxnc_environment *environi, const char *type, const char *str)
 
int c_createXPathProcessor (sxnc_environment *environi, sxnc_processor *processor, sxnc_xpath *xpath)
 
sxnc_valueevaluate (sxnc_environment *environi, sxnc_xpath *proc, char *cwd, char *xpathStr, char *encoding, sxnc_parameter *parameters, sxnc_property *properties, int parLen, int propLen)
 
sxnc_valueevaluateSingle (sxnc_environment *environi, sxnc_xpath *proc, char *cwd, char *xpathStr, char *encoding, sxnc_parameter *parameters, sxnc_property *properties, int parLen, int propLen)
 
bool effectiveBooleanValue (sxnc_environment *environi, sxnc_xpath *proc, char *cwd, char *xpathStr, char *encoding, sxnc_parameter *parameters, sxnc_property *properties, int parLen, int propLen)
 
bool isAtomicValue (sxnc_environment *environi, sxnc_value value)
 
int size (sxnc_environment *environi, sxnc_value val)
 
const char * getStringValue (sxnc_environment *environi, sxnc_value value)
 
int getIntegerValue (sxnc_environment *environi, sxnc_value value, int failure_value)
 
bool getBooleanValue (sxnc_environment *environi, sxnc_value value)
 
long getLongValue (sxnc_environment *environi, sxnc_value value, long failureVal)
 
float getFloatValue (sxnc_environment *environi, sxnc_value value, float failureVal)
 
double getDoubleValue (sxnc_environment *environi, sxnc_value value, double failureVal)
 

Detailed Description

SaxonCXPath.h provides the C API for XPath processing. This file contains a set of functions to compile and execute XPath expressions.

Function Documentation

◆ booleanValue()

int64_t booleanValue ( sxnc_environment environi,
bool   
)

Create a boxed Boolean value

Parameters
val- boolean value

◆ c_createXPathProcessor()

int c_createXPathProcessor ( sxnc_environment environi,
sxnc_processor processor,
sxnc_xpath xpath 
)

Initialise the Saxon Processor and XPath processor. This utility function is used to allocate memory on the heap, therefore is required to be called before execution of XPath.

Parameters
environi- GraalVM environment held as the struct sxnc_environment. This function calls malloc on the pointer.
processor- Pointer to the Saxon Processor which is represented as the struct sxnc_processor and is used for creating the XPath processor. This function calls malloc on the pointer.
xpath- Pointer to the sxnc_xpath struct which is used for the execution of XPath expressions. This function calls malloc on the pointer

◆ doubleValue()

int64_t doubleValue ( sxnc_environment environi,
double  d 
)

Create a boxed Double value

Parameters
d- double value

◆ effectiveBooleanValue()

bool effectiveBooleanValue ( sxnc_environment environi,
sxnc_xpath proc,
char *  cwd,
char *  xpathStr,
char *  encoding,
sxnc_parameter parameters,
sxnc_property properties,
int  parLen,
int  propLen 
)

Evaluate an XPath expression, returning the effective boolean value of the result.

Parameters
environi- GraalVM environment
proc- Pointer to the XPath Processor used for creating the XPath executable
cwd- Current working directory
xpathStr- A string containing the source text of the XPath expression
encoding- the encoding of the string. Accept null. If not specified then the platform default encoding is used.
parameters- Array of parameters for the XPath expression, as mappings (string, value)
properties- Array of properties for the XPath expression, as mappings (string, string). This could contain the context node, source as string or file name, etc.
parLen- The length of the parameters array
propLen- The length of the properties array

◆ evaluate()

sxnc_value * evaluate ( sxnc_environment environi,
sxnc_xpath proc,
char *  cwd,
char *  xpathStr,
char *  encoding,
sxnc_parameter parameters,
sxnc_property properties,
int  parLen,
int  propLen 
)

Compile and evaluate an XPath expression, supplied as a character string, with properties and parameters required by the XPath expression.

Parameters
environi- GraalVM environment
proc- Pointer to the XPath Processor used for creating the XPath executable
cwd- Current working directory
xpathStr- A string containing the source text of the XPath expression
encoding- the encoding of the string. Accept null. If not specified then the platform default encoding is used.
parameters- Array of parameters for the XPath expression, as mappings (string, value)
properties- Array of properties for the XPath expression, as mappings (string, string). This could contain the context node, source as string or file name, etc.
parLen- The length of the parameters array
propLen- The length of the properties array
Returns
sxnc_value - The sxnc_value struct encapsulates the returned XdmValue object or NULL if the expression returns an empty sequence.

◆ evaluateSingle()

sxnc_value * evaluateSingle ( sxnc_environment environi,
sxnc_xpath proc,
char *  cwd,
char *  xpathStr,
char *  encoding,
sxnc_parameter parameters,
sxnc_property properties,
int  parLen,
int  propLen 
)

Compile and evaluate an XPath expression for which the result is expected to be a single XdmItem or NULL. The XPath expression is supplied as a character string, with properties and parameters required by the XPath expression.

Parameters
environi- GraalVM environment
proc- Pointer to the XPath Processor used for creating the XPath executable
cwd- Current working directory
xpathStr- A string containing the source text of the XPath expression
encoding- the encoding of the string. Accept null. If not specified then the platform default encoding is used.
parameters- Array of parameters for the XPath expression, as mappings (string, value)
properties- Array of properties for the XPath expression, as mappings (string, string). This could contain the context node, source as string or file name, etc.
parLen- The length of the parameters array
propLen- The length of the properties array
Returns
sxnc_value - The sxnc_value struct encapsulates the returned XdmItem object or NULL if the expression returns an empty sequence.

◆ floatValue()

int64_t floatValue ( sxnc_environment environi,
float  f 
)

Create a boxed Float value

Parameters
f- float value

◆ getBooleanValue()

bool getBooleanValue ( sxnc_environment environi,
sxnc_value  value 
)

Get the boolean value of the item.

Parameters
value- Value to convert to boolean

◆ getDoubleValue()

double getDoubleValue ( sxnc_environment environi,
sxnc_value  value,
double  failureVal 
)

Get the double value of the item.

Parameters
value- Value to convert to double
failureVal- If the Value is not a double then we can specify the value to return. Default is zero.

◆ getFloatValue()

float getFloatValue ( sxnc_environment environi,
sxnc_value  value,
float  failureVal 
)

Get the float value of the item.

Parameters
value- Value to convert to float
failureVal- If the Value is not a float then we can specify the value to return. Default is zero.

◆ getIntegerValue()

int getIntegerValue ( sxnc_environment environi,
sxnc_value  value,
int  failure_value 
)

Get the integer value of the item.

Parameters
value- Value to convert to integer
failure_value- If the value is not an integer then we can specify the value to return. Default is zero.

◆ getJavaStringValue()

int64_t getJavaStringValue ( sxnc_environment environi,
const char *  str 
)

Create a boxed String value

Parameters
str- char array value

◆ getLongValue()

long getLongValue ( sxnc_environment environi,
sxnc_value  value,
long  failureVal 
)

Get the long value of the item.

Parameters
value- Value to convert to long
failureVal- If the Value is not a long then we can specify the value to return. Default is zero.

◆ getStringValue()

const char * getStringValue ( sxnc_environment environi,
sxnc_value  value 
)

Get the string value of the item. For a node, this gets the string value of the node. For an atomic value, it has the same effect as casting the value to a string. In all cases the result is the same as applying the XPath string() function.

Parameters
value- Value to convert to string

◆ integerValue()

int64_t integerValue ( sxnc_environment environi,
int  i 
)

Create a boxed Integer value

Parameters
i- int value

◆ isAtomicValue()

bool isAtomicValue ( sxnc_environment environi,
sxnc_value  value 
)

Determine whether the item is an atomic value or a node

Parameters
value- XDM value
Returns
true if the item is an atomic value, false if it is a node

◆ longValue()

int64_t longValue ( sxnc_environment environi,
long  l 
)

Create a boxed Long value

Parameters
l- long value

◆ size()

int size ( sxnc_environment environi,
sxnc_value  val 
)

Get the number of items in the sequence

Parameters
val- XDM value
Returns
the number of items in the value - always one

◆ xdmValue()

sxnc_value * xdmValue ( sxnc_environment environi,
const char *  type,
const char *  str 
)

A Constructor. Create an XdmValue based on the target type. Conversion is applied if possible.

Parameters
type- the target type of the value
str- value to convert

◆ xdmValueAsObj()

int64_t xdmValueAsObj ( sxnc_environment environi,
const char *  type,
const char *  str 
)

A Constructor for internal use. Create an underlying representation for the XdmValue based on the target type. Conversion is applied if possible.

Parameters
type- the target type of the value
str- value to convert