XQC_Item_s Struct Reference

This struct is Zorba's representation of an Item as defined in the XQuery 1.0 and XPath 2.0 Data Model (XDM); see http://www.w3.org/TR/xpath-datamodel/. More...

#include <zorba/zorbac.h>


Data Fields

XQUERY_ERROR(* boolean_value )(XQC_Item item, int *bool_value)
 Get the bool value of the boolean Item.
void * data
 for internal use only
void(* free )(XQC_Item item)
 Called to free the resources associated with the XQC_Item.
XQUERY_ERROR(* localname )(XQC_Item item, const char **local_name)
 Get the value of a QName's localname.
XQUERY_ERROR(* nan )(XQC_Item item, int *is_nan)
 Check if the value of the Item is not a number (NaN).
XQUERY_ERROR(* ns )(XQC_Item item, const char **ns)
 Get the (optional) value of a QName's namespace.
XQUERY_ERROR(* pos_or_neg_inf )(XQC_Item item, int *inf)
 Check if the value of the Item is positive or negative infinity.
XQUERY_ERROR(* prefix )(XQC_Item item, const char **prefix)
 Get the (optional) value of a QName's prefix.
XQUERY_ERROR(* string_value )(XQC_Item item, const char **string_value)
 The string value is the string that is extracted by calling the fn:string function on the Item (see http://www.w3.org/TR/xpath-functions/#func-string).


Detailed Description

This struct is Zorba's representation of an Item as defined in the XQuery 1.0 and XPath 2.0 Data Model (XDM); see http://www.w3.org/TR/xpath-datamodel/.

Instances of the XDM are a sequence, i.e. an ordered collection of zero or more items. In the Zorba API, a sequence is represented by the XQC_Sequence struct.

The Item class is the union of all XQuery node and atomic types. The class provides functions to access the information of an Item. Note that not all functions are defined on every Item kind. If a function is called on an Item that does not provide the function called, an XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE error is raised.

A new atomic Item can be created using the ItemFactory. A new node Item should be created by the result of a query.

Examples:

ccontext.c, cdatamanager.c, cerror.c, cexternal_functions.c, and csimple.c.

Definition at line 919 of file zorbac.h.


Field Documentation

XQUERY_ERROR(* XQC_Item_s::boolean_value)(XQC_Item item, int *bool_value)

Get the bool value of the boolean Item.

Note that this function is only available for Items of type boolean.

Parameters:
item The XQC_Item that this function pointer is a member of
[out] bool_value 1 if the boolean value of the given item is true, 0 otherwise.
Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE 

void* XQC_Item_s::data

for internal use only

Definition at line 1036 of file zorbac.h.

void(* XQC_Item_s::free)(XQC_Item item)

Called to free the resources associated with the XQC_Item.

Parameters:
item The XQC_Item that this function pointer is a member of
Examples:
ccontext.c, cdatamanager.c, cerror.c, and csimple.c.

XQUERY_ERROR(* XQC_Item_s::localname)(XQC_Item item, const char **local_name)

Get the value of a QName's localname.

Note that this function is only available for Items of type QName.

Parameters:
item The XQC_Item that this function pointer is a member of
[out] localname The localname of the given QName item. This string is valid as long as the given item is valid.
Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE 

XQUERY_ERROR(* XQC_Item_s::nan)(XQC_Item item, int *is_nan)

Check if the value of the Item is not a number (NaN).

Note that this function is implemented for all item types but may only return 1 for a numeric item (e.g. Double or Float).

Parameters:
item The XQC_Item that this function pointer is a member of
[out] is_nan 1 if the given item is not a number, 0 otherwise.
Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE 

XQUERY_ERROR(* XQC_Item_s::ns)(XQC_Item item, const char **ns)

Get the (optional) value of a QName's namespace.

Note that this function is only available for Items of type QName.

Parameters:
item The XQC_Item that this function pointer is a member of
[out] namespace The namespace of the given QName item. This string is valid as long as the given item is valid.
Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE 

XQUERY_ERROR(* XQC_Item_s::pos_or_neg_inf)(XQC_Item item, int *inf)

Check if the value of the Item is positive or negative infinity.

Note that this function is only available for numeric items (e.g. Double or Float).

Parameters:
item The XQC_Item that this function pointer is a member of
[out] inf 1 if the given item is +/-INF, 0 otherwise.
Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE 

XQUERY_ERROR(* XQC_Item_s::prefix)(XQC_Item item, const char **prefix)

Get the (optional) value of a QName's prefix.

Note that this function is only available for Items of type QName.

Parameters:
item The XQC_Item that this function pointer is a member of
[out] prefix The prefix of the given QName item. This string is valid as long as the given item is valid.
Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE 

XQUERY_ERROR(* XQC_Item_s::string_value)(XQC_Item item, const char **string_value)

The string value is the string that is extracted by calling the fn:string function on the Item (see http://www.w3.org/TR/xpath-functions/#func-string).

Note that this function is available for all types of Items.

Parameters:
item The XQC_Item that this function pointer is a member of
[out] string_value The string-value of the given item. This string is valid as long as the given item is valid.
Return values:
XQC_NO_ERROR 
XQP0019_INTERNAL_ERROR 
XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE 
Examples:
ccontext.c, cdatamanager.c, cerror.c, and csimple.c.


The documentation for this struct was generated from the following file: