> The XQuery Processor
00001 /* 00002 * Copyright 2006-2008 The FLWOR Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #ifndef ZORBA_ZORBAC_API_H 00017 #define ZORBA_ZORBAC_API_H 00018 00019 #include <stdio.h> 00020 #include <zorba/error.h> 00021 #include <zorba/config.h> 00022 #include <zorba/static_context_consts.h> 00023 #include <zorba/options.h> 00024 00025 typedef struct XQC_Implementation_s* XQC_Implementation; 00026 typedef XQC_Implementation* XQC_Implementation_Ref; 00027 00028 typedef struct XQC_Query_s* XQC_Query; 00029 typedef XQC_Query* XQC_Query_Ref; 00030 00031 typedef struct XQC_StaticContext_s* XQC_StaticContext; 00032 typedef XQC_StaticContext* XQC_StaticContext_Ref; 00033 00034 typedef struct XQC_DynamicContext_s* XQC_DynamicContext; 00035 typedef XQC_DynamicContext* XQC_DynamicContext_Ref; 00036 00037 typedef struct XQC_Sequence_s* XQC_Sequence; 00038 typedef XQC_Sequence* XQC_Sequence_Ref; 00039 00040 typedef struct XQC_Item_s* XQC_Item; 00041 typedef XQC_Item* XQC_Item_Ref; 00042 00043 typedef struct XQC_ItemFactory_s* XQC_ItemFactory; 00044 typedef XQC_ItemFactory* XQC_ItemFactory_Ref; 00045 00046 typedef struct XQC_Collection_s* XQC_Collection; 00047 typedef XQC_Collection* XQC_Collection_Ref; 00048 00049 typedef struct XQC_DataManager_s* XQC_DataManager; 00050 typedef XQC_DataManager* XQC_DataManager_Ref; 00051 00052 typedef struct XQC_OutputStream_s* XQC_OutputStream; 00053 typedef struct XQC_InputStream_s* XQC_InputStream; 00054 typedef struct XQC_ErrorHandler_s* XQC_ErrorHandler; 00055 00056 00057 // external functions 00058 typedef void (*external_function_init)(void** user_data, void* global_user_data); 00059 00060 typedef XQUERY_ERROR (*external_function_next) (XQC_Sequence args, 00061 int argc, 00062 XQC_Item_Ref result, 00063 void* user_data, 00064 void* global_user_data); 00065 00066 typedef void (*external_function_release)(void* user_data, void* global_user_data); 00067 00068 00069 #ifdef __cplusplus 00070 extern "C" { 00071 #endif 00072 00073 /** 00074 * The zorba_implementation function creates a new ::XQC_Implementation object. 00075 * Thereby, the Zorba processor is initialized. 00076 * The user is responsible for freeing the object by calling the free() function 00077 * of the XQC_Implementation struct. 00078 * 00079 * \param store A pointer to the store that is being used by the Zorba instance that is created 00080 * by this call. 00081 * \param[out] impl The newly created XQC_Implementation object. 00082 * 00083 * \retval ::XQC_NO_ERROR 00084 * \retval ::XQP0019_INTERNAL_ERROR 00085 */ 00086 ZORBA_DLL_PUBLIC XQUERY_ERROR 00087 zorba_implementation(XQC_Implementation_Ref impl, void* store); 00088 00089 00090 /** 00091 * The ::XQC_Implementation struct provides factory functions for parsing queries. 00092 * An XQC_Implementation object is thread-safe and can be used by multiple threads 00093 * of execution at the same time. 00094 * 00095 * Creating an XQC_Implementation object can be done using the zorba_implementation function. 00096 * Once created, the user is responsible for freeing the object by calling 00097 * the free() function. 00098 * The XQC_Implementation object should not be freed before all objects created using it's 00099 * functions have been freed - doing so causes undefined behaviour. 00100 */ 00101 struct XQC_Implementation_s 00102 { 00103 00104 /** 00105 * Creates a static context suitable for use in the parse() and parse_file() 00106 * functions. The user is responsible for freeing the ::XQC_StaticContext object returned by calling 00107 * XQC_StaticContext::free(). 00108 * 00109 * \param implementation The XQC_Implementation that this function pointer is a member of 00110 * \param[out] context The newly created XQC_StaticContext object. 00111 * 00112 * \retval ::XQC_NO_ERROR 00113 * \retval ::XQP0019_INTERNAL_ERROR 00114 */ 00115 XQUERY_ERROR 00116 (*create_context)(XQC_Implementation impl, XQC_StaticContext_Ref context); 00117 00118 /** 00119 * Prepares a query from a string, returning an ::XQC_Query object. 00120 * The user is responsible for freeing the ::XQC_Query object 00121 * returned by calling XQC_Query::free(). 00122 * 00123 * \param implementation The XQC_Implementation that this function pointer is a member of. 00124 * \param string The query to prepare as a string. 00125 * \param context The initial static context for this query, or null to use the default 00126 * static context. 00127 * \param handler An optional error handler whose <code>error</code> function is called 00128 * if preparing the query fails. 00129 * \param[out] expression The resulting prepared expression. 00130 * 00131 * \retval ::XQC_NO_ERROR 00132 * \retval ::XQP0019_INTERNAL_ERROR 00133 * \retval An XQuery static or type error (e.g. XPST*, XPTY*) 00134 */ 00135 XQUERY_ERROR 00136 (*prepare)(XQC_Implementation implementation, 00137 const char *query_string, 00138 XQC_StaticContext context, 00139 XQC_ErrorHandler handler, 00140 XQC_Query_Ref query); 00141 00142 /** 00143 * Prepares a query from a FILE pointer, returning an ::XQC_Query object. 00144 * The user remains responsible for closing the file after parsing. 00145 * The user is responsible for freeing the ::XQC_Query object returned by 00146 * calling XQC_Query::free(). 00147 * 00148 * \param implementation The XQC_Implementation that this function pointer is a member of. 00149 * \param file The file containing the query to prepare. 00150 * \param context The initial static context for this query, or null to use the default 00151 * static context. 00152 * \param handler An optional error handler whose <code>error</code> function is called 00153 * if preparing the query fails. 00154 * \param[out] expression The resulting prepared expression. 00155 * 00156 * \retval ::XQC_NO_ERROR 00157 * \retval ::XQP0019_INTERNAL_ERROR 00158 * \retval An XQuery static or type error (e.g. XPST*, XPTY*) 00159 */ 00160 XQUERY_ERROR 00161 (*prepare_file)(XQC_Implementation implementation, 00162 FILE *query_file, 00163 XQC_StaticContext context, 00164 XQC_ErrorHandler handler, 00165 XQC_Query_Ref query); 00166 00167 /** 00168 * Prepares a query from a ::XQC_InputStream, returning an ::XQC_Query object. 00169 * The user is responsible for freeing the ::XQC_Query object returned by 00170 * calling XQC_Query::free(). 00171 * 00172 * \param implementation The XQC_Implementation that this function pointer is a member of. 00173 * \param stream The input stream returning the query to prepare. 00174 * free will be called on the XQC_InputStream after the query has been read. 00175 * \param context The initial static context for this query, or null to use the default 00176 * static context. 00177 * \param handler An optional error handler whose <code>error</code> function is called 00178 * if preparing the query fails. 00179 * \param[out] expression The resulting prepared expression. 00180 * 00181 * \retval ::XQC_NO_ERROR 00182 * \retval ::XQP0019_INTERNAL_ERROR 00183 * \retval An XQuery static or type error (e.g. XPST*, XPTY*) 00184 */ 00185 XQUERY_ERROR 00186 (*prepare_stream)(XQC_Implementation implementation, 00187 XQC_InputStream stream, 00188 XQC_StaticContext context, 00189 XQC_ErrorHandler handler, 00190 XQC_Query_Ref query); 00191 00192 /** 00193 * Creates an item wrapper suitable for use in the ::XQC_Sequence::next function or 00194 * the ::XQC_ItemFactory::create functions. 00195 * The user is responsible for freeing the XQC_Item object returned by calling 00196 * XQC_Item::free(). 00197 * 00198 * \param implementation The XQC_Implementation that this function pointer is a member of 00199 * \param[out] item The newly created XQC_Item wrapper object. 00200 * 00201 * \retval ::XQC_NO_ERROR 00202 * \retval ::XQP0019_INTERNAL_ERROR 00203 */ 00204 XQUERY_ERROR 00205 (*create_item)(XQC_Implementation implementation, XQC_Item_Ref item); 00206 00207 /** 00208 * Creates a XQC_ItemFactory that can be used for creating items, i.e. instances of the 00209 * XQuery data model (XDM). 00210 * The user is responsible for freeing the XQC_ItemFactory object returned by calling 00211 * XQC_ItemFactory::free(). 00212 * 00213 * \param implementation The XQC_Implementation that this function pointer is a member of 00214 * \param[out] factory The newly created XQC_ItemFactory object. 00215 * 00216 * \retval ::XQC_NO_ERROR 00217 * \retval ::XQP0019_INTERNAL_ERROR 00218 */ 00219 XQUERY_ERROR 00220 (*item_factory)(XQC_Implementation implementation, XQC_ItemFactory_Ref factory); 00221 00222 /** 00223 * Creates a XQC_DataManager that can be used for managing collections and documents. 00224 * The user is responsible for freeing the XQC_DataManager object returned by calling 00225 * XQC_DataManager::free(). 00226 * 00227 * \param implementation The XQC_Implementation that this function pointer is a member of 00228 * \param[out] data_manager The newly created XQC_DataManager object. 00229 * 00230 * \retval ::XQC_NO_ERROR 00231 * \retval ::XQP0019_INTERNAL_ERROR 00232 */ 00233 XQUERY_ERROR 00234 (*data_manager)(XQC_Implementation implementation, XQC_DataManager_Ref data_manager); 00235 00236 00237 /** 00238 * Called to free the resources associated with the XQC_Implementation. 00239 * 00240 * \param implementation The XQC_Implementation that this function pointer is a member of 00241 */ 00242 void 00243 (*free)(XQC_Implementation implementation); 00244 00245 /** 00246 * for internal use only 00247 */ 00248 void* data; 00249 }; 00250 00251 /** 00252 * The ::XQC_Expression struct represents a pre-parsed query, and allows the user to execute 00253 * that query any number of times. An ::XQC_Expression object is thread-safe and 00254 * can be used by multiple threads of execution at the same time. 00255 * 00256 * ::XQC_Expression objects are created by calling the XQC_Implementation::prepare() or 00257 * XQC_Implementation::prepare_file() functions. 00258 * Once created, the user is responsible for freeing the object by calling the free() function. 00259 * The ::XQC_Expression object should be freed before the ::XQC_Implementation object 00260 * that created it. 00261 */ 00262 struct XQC_Query_s 00263 { 00264 /** 00265 * This function returns the dynamic context that belongs to this query and 00266 * is used during query execution. 00267 * The context can be used, for example, to set values of external variables, 00268 * the default collation, or the current datetime. 00269 * It is only available if the query has been compiled, otherwise 00270 * an error is reported. Moreover, the context must not be modified during the 00271 * execution of a query (i.e. if a ResultIterator is opened). 00272 * The user is responsible for freeing the ::XQC_DynamicContext object returned by calling 00273 * XQC_DynamicContext::free(). 00274 * 00275 * \retval ::XQC_NO_ERROR 00276 * \retval ::XQP0019_INTERNAL_ERROR 00277 */ 00278 XQUERY_ERROR 00279 (*get_dynamic_context)(XQC_Query query, XQC_DynamicContext_Ref context); 00280 00281 /** 00282 * This function returns the static context that belongs to this query. 00283 * The static context is only available if the query has been compiled, otherwise 00284 * an error is reported. 00285 * The context has all the components and values that have been set by the either 00286 * the static context that was passed when creating the query and and those that 00287 * were set in the prolog of the query. 00288 * Note that after compilation of the query the static context is a read only structure. 00289 * The user is responsible for freeing the ::XQC_StaticContext object returned by calling 00290 * XQC_StaticContext::free(). 00291 * 00292 * \retval ::XQC_NO_ERROR 00293 * \retval ::XQP0019_INTERNAL_ERROR 00294 */ 00295 XQUERY_ERROR 00296 (*get_static_context)(XQC_Query, XQC_StaticContext_Ref context); 00297 00298 /** 00299 * Executes the query represented by the XQC_Query object and prints the serialized XML 00300 * output to the given FILE pointer. The user remains responsible for closing 00301 * the file. 00302 * 00303 * \param query The XQC_Query that this function pointer is a member of. 00304 * \param file The FILE pointer to print the serialized result to. 00305 * 00306 * \retval ::XQC_NO_ERROR 00307 * \retval ::XQP0019_INTERNAL_ERROR 00308 * \retval ::API0023_CANNOT_SERIALIZE_UPDATE_QUERY 00309 * \retval An XQuery dynamic or type error (e.g. XPDY*, XPTY*) 00310 */ 00311 XQUERY_ERROR 00312 (*execute)(XQC_Query query, FILE* file); 00313 00314 /** 00315 * Executes the query represented by the XQC_Query object and prints the serialized 00316 * output to the given FILE pointer. The target format of the serialization is 00317 * specified by the passed serializer options. 00318 * 00319 * \param query The XQC_Query that this function pointer is a member of. 00320 * \param options The Zorba_SerializerOptions_t that specifies serializer options. 00321 * \param file The FILE pointer to print the serialized result to. 00322 * 00323 * \retval ::XQC_NO_ERROR 00324 * \retval ::XQP0019_INTERNAL_ERROR 00325 * \retval ::API0023_CANNOT_SERIALIZE_UPDATE_QUERY 00326 * \retval An XQuery dynamic or type error (e.g. XPDY*, XPTY*) 00327 */ 00328 XQUERY_ERROR 00329 (*serialize_file)(XQC_Query query, const Zorba_SerializerOptions_t* options, FILE* file); 00330 00331 /** 00332 * Executes the query represented by the XQC_Query object and writes the serialized 00333 * output to the given ::XQC_OutputStream. The target format of the serialization is 00334 * specified by the passed serializer options. 00335 * 00336 * \param query The XQC_Query that this function pointer is a member of. 00337 * \param options The Zorba_SerializerOptions_t that specifies serializer options. 00338 * \param file The XQC_OutputStream to print the serialized result to. 00339 * 00340 * \retval ::XQC_NO_ERROR 00341 * \retval ::XQP0019_INTERNAL_ERROR 00342 * \retval ::API0023_CANNOT_SERIALIZE_UPDATE_QUERY 00343 * \retval An XQuery dynamic or type error (e.g. XPDY*, XPTY*) 00344 */ 00345 XQUERY_ERROR 00346 (*serialize_stream)(XQC_Query query, const Zorba_SerializerOptions_t* options, XQC_OutputStream stream); 00347 00348 /** 00349 * Checks if the query is an updating query. 00350 * 00351 * \param query The XQC_Query that this function pionter is a member of. 00352 * 00353 * \retval 1 if query is updating query, else 0 00354 */ 00355 int 00356 (*is_update_query)(XQC_Query query); 00357 00358 /** 00359 * Applies the updates declared in the query represented by the XQC_Query object. 00360 * 00361 * \param query The XQC_Query that this function pointer is a member of. 00362 * 00363 * \retval ::XQC_NO_ERROR 00364 * \retval ::XQP0019_INTERNAL_ERROR 00365 * \retval ::API0023_CANNOT_SERIALIZE_UPDATE_QUERY 00366 * \retval An XQuery dynamic or type error (e.g. XPDY*, XPTY*) 00367 */ 00368 XQUERY_ERROR 00369 (*apply_updates)(XQC_Query query); 00370 00371 /** 00372 * Executes the query represented by the XQC_Query object. 00373 * An ::XQC_Sequence object is returned which can be used to examine the results 00374 * of the query execution. The user is responsible for freeing the 00375 * ::XQC_Sequence object returned by calling XQC_Sequence::free(). 00376 * 00377 * \param query The XQC_Query that this function pointer is a member of. 00378 * \param[out] sequence The newly created XQC_Sequence object. 00379 * 00380 * \retval ::XQC_NO_ERROR 00381 * \retval ::XQP0019_INTERNAL_ERROR 00382 * \retval ::API0024_CANNOT_ITERATE_OVER_UPDATE_QUERY 00383 * \retval An XQuery dynamic or type error (e.g. XPDY*, XPTY*) 00384 */ 00385 XQUERY_ERROR 00386 (*sequence)(XQC_Query query, XQC_Sequence_Ref sequence); 00387 00388 /** 00389 * Sets the error handler whose <code>error</code> function is called 00390 * if an error occurs when executing the query. 00391 * The user keeps the ownership of this object and is required to freeing 00392 * the aquired resources. 00393 */ 00394 void 00395 (*set_error_handler)(XQC_Query query, XQC_ErrorHandler handler); 00396 00397 /** 00398 * Called to free the resources associated with the XQC_Query. 00399 * 00400 * \param query The XQC_Query that this function pointer is a member of. 00401 */ 00402 void 00403 (*free)(XQC_Query query); 00404 00405 /** 00406 * for internal use only 00407 */ 00408 void* data; 00409 }; 00410 00411 /** 00412 * The ::XQC_StaticContext struct provides a way to specify values for the static context of 00413 * the query to be prepared. An ::XQC_StaticContext object is not thread-safe - threads should 00414 * each use their own instance of a ::XQC_StaticContext object (see create_child_context). 00415 * 00416 * ::XQC_StaticContext objects are created by calling the XQC_Implementation::create_context() 00417 * function. Once created, the user is responsible for freeing the object by calling 00418 * the free() function. 00419 * The ::XQC_StaticContext object should be freed before the ::XQC_Implementation object that 00420 * created it. 00421 */ 00422 struct XQC_StaticContext_s 00423 { 00424 /** 00425 * Creates a child context of the given static context. 00426 * A child context contains the same information as it's parent context but 00427 * it allows the user to override and add information. 00428 * The user is responsible for freeing the ::XQC_StaticContext object returned by calling 00429 * XQC_StaticContext::free(). 00430 * 00431 * \param context The XQC_StaticContext that this function pointer is a member of 00432 * \param[out] child_context The newly created XQC_StaticContext object which is 00433 * a child of the given context. 00434 * 00435 * \retval ::XQC_NO_ERROR 00436 * \retval ::XQP0019_INTERNAL_ERROR 00437 */ 00438 XQUERY_ERROR 00439 (*create_child_context)(XQC_StaticContext context, XQC_StaticContext_Ref child_context); 00440 00441 /** 00442 * Adds a (prefix, uri) pair to the set of statically known namespaces of 00443 * the given context. 00444 * 00445 * \param context The XQC_StaticContext that this function pointer is a member of. 00446 * \param prefix The prefix of the namespace to add to the given XQC_StaticContext. 00447 * \param uri The uri of the namespace to add to the given XQC_StaticContext. 00448 * 00449 * \retval ::XQC_NO_ERROR 00450 * \retval ::XQC_INTERNAL_ERROR 00451 */ 00452 XQUERY_ERROR 00453 (*declare_ns)(XQC_StaticContext context, const char* prefix, const char* uri); 00454 00455 /** 00456 * Returns the namespace uri that belongs to the given prefix. 00457 * 00458 * \param context The XQC_StaticContext that this function pointer is a member of 00459 * \param prefix The prefix of the namespace to add to the given XQC_StaticContext. 00460 * \param[out] result_ns The namespace uri of the namespace registered with the given prefix. 00461 * 00462 * \retval ::XQC_NO_ERROR 00463 * \retval ::XQC_INTERNAL_ERROR 00464 */ 00465 XQUERY_ERROR 00466 (*get_ns_by_prefix)(XQC_StaticContext context, const char* prefix, const char** result_ns); 00467 00468 /** 00469 * Sets the value of the default namespace for elements and types. 00470 * 00471 * \param context The XQC_StaticContext that this function pointer is a member of 00472 * \param uri The uri of the default element and type namespace to set in the given context. 00473 * 00474 * \retval ::XQC_NO_ERROR 00475 * \retval ::XQC_INTERNAL_ERROR 00476 */ 00477 XQUERY_ERROR 00478 (*set_default_element_and_type_ns)(XQC_StaticContext context, const char* uri); 00479 00480 /** 00481 * Returns the default namespace for elements and types. 00482 * 00483 * \param context The XQC_StaticContext that this function pointer is a member of 00484 * \param[out] uri The uri of the default element and type namespace that is set in the given context. 00485 * 00486 * \retval ::XQC_NO_ERROR 00487 * \retval ::XQC_INTERNAL_ERROR 00488 */ 00489 XQUERY_ERROR 00490 (*get_default_element_and_type_ns)(XQC_StaticContext context, const char** uri); 00491 00492 /** 00493 * Sets the default namespace for functions. 00494 * 00495 * \param context The XQC_StaticContext that this function pointer is a member of 00496 * \param uri The uri of the default function namespace to set in the given context. 00497 * 00498 * \retval ::XQC_NO_ERROR 00499 * \retval ::XQC_INTERNAL_ERROR 00500 */ 00501 XQUERY_ERROR 00502 (*set_default_function_ns)(XQC_StaticContext context, const char* uri); 00503 00504 /** 00505 * Returns the default namespace for functions set in this static context. 00506 * 00507 * \param context The XQC_StaticContext that this function pointer is a member of 00508 * \param[out] uri The uri of the default function namespace that is set in the given context. 00509 * 00510 * \retval ::XQC_NO_ERROR 00511 * \retval ::XQC_INTERNAL_ERROR 00512 */ 00513 XQUERY_ERROR 00514 (*get_default_function_ns)(XQC_StaticContext context, const char** uri); 00515 00516 /** 00517 * Add a collation URI. 00518 * The URI specifies the locale and collation strength of the collation that is added. 00519 * A valid collation URI must begin with http://www.flworfound.org/collations/. 00520 * This prefix is followed by a collation strength (i.e. PRIMARY, SECONDARY, TERTIARY, 00521 * QUATTERNARY, or IDENTICAL) followed by a '/'. 00522 * After the strength a lower-case two- or three-letter ISO-639 language code must follow. 00523 * The URI may end with an upper-case two-letter ISO-3166. 00524 * For example, http://www.flworfound.org/collations/PRIMARY/en/US 00525 * specifies an english language with US begin the country.. 00526 * 00527 * Internally, ICU is used for comparing strings. For detailed description see 00528 * http://www.icu-project.org/apiref/icu4c/classCollator.html 00529 * and http://www.icu-project.org/apiref/icu4c/classLocale.html 00530 * 00531 * \param context The XQC_StaticContext that this function pointer is a member of 00532 * \param uri The URI of the collation to add. 00533 * 00534 * \retval ::XQC_NO_ERROR 00535 * \retval ::XQST0038 00536 * \retval ::XQC_INTERNAL_ERROR 00537 */ 00538 XQUERY_ERROR 00539 (*add_collation)(XQC_StaticContext context, const char* uri); 00540 00541 /** 00542 * Set the URI of the default collation. 00543 * (see http://www.w3.org/TR/xquery/#static_context) 00544 * 00545 * \param context The XQC_StaticContext that this function pointer is a member of 00546 * \param uri The URI of the default collation to set 00547 * 00548 * \retval ::XQC_NO_ERROR 00549 * \retval ::XQST0038 00550 * \retval ::XQC_INTERNAL_ERROR 00551 */ 00552 XQUERY_ERROR 00553 (*set_default_collation)(XQC_StaticContext context, const char* uri); 00554 00555 /** 00556 * Get the URI of the default collation. The uri returned is valid 00557 * as long as the corresponding XQC_StaticContext object is valid. 00558 * 00559 * \param context The XQC_StaticContext that this function pointer is a member of 00560 * \param[out] uri The URI of the default collation that is currently set in the given context. 00561 */ 00562 XQUERY_ERROR 00563 (*get_default_collation)(XQC_StaticContext context, const char** uri); 00564 00565 /** 00566 * Sets the XPath 1.0 compatibility mode to either xpath1_0 or xpath2_0. 00567 * 00568 * \param context The XQC_StaticContext that this function pointer is a member of 00569 * \param mode The xpath1_0compatib_mode_t to set in the given context. 00570 * 00571 * \retval ::XQC_NO_ERROR 00572 * \retval ::XQC_INTERNAL_ERROR 00573 */ 00574 XQUERY_ERROR 00575 (*set_xpath1_0_mode)(XQC_StaticContext context, xpath1_0compatib_mode_t mode ); 00576 00577 /** 00578 * Returns the XPath 1.0 compatibility that is set in the given static context. 00579 * 00580 * \param context The XQC_StaticContext that this function pointer is a member of 00581 * \param[out] mode The xpath1_0compatib_mode_t that is set in the given context. 00582 * 00583 * \retval ::XQC_NO_ERROR 00584 * \retval ::XQC_INTERNAL_ERROR 00585 */ 00586 XQUERY_ERROR 00587 (*get_xpath1_0_mode)(XQC_StaticContext context, xpath1_0compatib_mode_t* mode); 00588 00589 /** 00590 * Sets the construction mode to either preserve_cons or strip_cons. 00591 * 00592 * \param context The XQC_StaticContext that this function pointer is a member of 00593 * \param mode The construction_mode_t to set in the given context. 00594 * 00595 * \retval ::XQC_NO_ERROR 00596 * \retval ::XQC_INTERNAL_ERROR 00597 */ 00598 XQUERY_ERROR 00599 (*set_construction_mode)(XQC_StaticContext context, construction_mode_t mode ); 00600 00601 /** 00602 * Returns the construction mode that is set in the given static context. 00603 * 00604 * \param context The XQC_StaticContext that this function pointer is a member of 00605 * \param[out] mode The construction_mode_t that is set in the given context. 00606 * 00607 * \retval ::XQC_NO_ERROR 00608 * \retval ::XQC_INTERNAL_ERROR 00609 */ 00610 XQUERY_ERROR 00611 (*get_construction_mode)(XQC_StaticContext context, construction_mode_t* mode); 00612 00613 /** 00614 * Sets the ordering mode to either order or unordered. 00615 * 00616 * \param context The XQC_StaticContext that this function pointer is a member of 00617 * \param mode The ordering_mode_t to set in the given context. 00618 * 00619 * \retval ::XQC_NO_ERROR 00620 * \retval ::XQC_INTERNAL_ERROR 00621 */ 00622 XQUERY_ERROR 00623 (*set_ordering_mode)(XQC_StaticContext context, ordering_mode_t mode ); 00624 00625 /** 00626 * Returns the ordering mode that is set in the given static context. 00627 * 00628 * \param context The XQC_StaticContext that this function pointer is a member of 00629 * \param[out] mode The ordering_mode_t that is set in the given context. 00630 * 00631 * \retval ::XQC_NO_ERROR 00632 * \retval ::XQC_INTERNAL_ERROR 00633 */ 00634 XQUERY_ERROR 00635 (*get_ordering_mode)(XQC_StaticContext context, ordering_mode_t* mode ); 00636 00637 /** 00638 * Sets the default order mode for empty sequences to either empty_least or 00639 * empty_greatest 00640 * 00641 * \param context The XQC_StaticContext that this function pointer is a member of 00642 * \param mode The order_empty_mode_t to set in the given context. 00643 * 00644 * \retval ::XQC_NO_ERROR 00645 * \retval ::XQC_INTERNAL_ERROR 00646 */ 00647 XQUERY_ERROR 00648 (*set_default_order_empty_sequences)(XQC_StaticContext context, order_empty_mode_t mode ); 00649 00650 /** 00651 * Returns the default order mode for empty sequences that is set in the given 00652 * static context. 00653 * 00654 * \param context The XQC_StaticContext that this function pointer is a member of 00655 * \param[out] mode The order_empty_mode_t that is set in the given context. 00656 * 00657 * \retval ::XQC_NO_ERROR 00658 * \retval ::XQC_INTERNAL_ERROR 00659 */ 00660 XQUERY_ERROR 00661 (*get_default_order_empty_sequences)(XQC_StaticContext context, order_empty_mode_t* mode ); 00662 00663 /** 00664 * Sets the boundary space policy to either preserve_space or strip_space. 00665 * 00666 * \param context The XQC_StaticContext that this function pointer is a member of 00667 * \param mode The boundary_space_mode_t to set in the given context. 00668 * 00669 * \retval ::XQC_NO_ERROR 00670 * \retval ::XQC_INTERNAL_ERROR 00671 */ 00672 XQUERY_ERROR 00673 (*set_boundary_space_policy)(XQC_StaticContext context, boundary_space_mode_t mode); 00674 00675 /** 00676 * Returns the boundary space policy that is set in the given static context. 00677 * 00678 * \param context The XQC_StaticContext that this function pointer is a member of 00679 * \param[out] mode The boundary_space_mode_t that is set in the given context. 00680 * 00681 * \retval ::XQC_NO_ERROR 00682 * \retval ::XQC_INTERNAL_ERROR 00683 */ 00684 XQUERY_ERROR 00685 (*get_boundary_space_policy)(XQC_StaticContext context, boundary_space_mode_t* mode ); 00686 00687 /** 00688 * Sets the copy namespace mode which consists of the preserve and the inherit mode. 00689 * 00690 * \param context The XQC_StaticContext that this function pointer is a member of 00691 * \param preserve The preserve_mode_t to set in the given context. 00692 * \param inherit The inherit_mode_t to set in the given context. 00693 * 00694 * \retval ::XQC_NO_ERROR 00695 * \retval ::XQC_INTERNAL_ERROR 00696 */ 00697 XQUERY_ERROR 00698 (*set_copy_ns_mode)(XQC_StaticContext context, 00699 preserve_mode_t preserve, 00700 inherit_mode_t inherit ); 00701 00702 /** 00703 * Returns the copy namespace mode as a pair consisting of the preserve and the inherit 00704 * mode. 00705 * 00706 * \param context The XQC_StaticContext that this function pointer is a member of 00707 * \param[out] preserve The preserve_mode_t that is set in the given context. 00708 * \param[out] inherit The inherit_mode_t that is set in the given context. 00709 * 00710 * \retval ::XQC_NO_ERROR 00711 * \retval ::XQC_INTERNAL_ERROR 00712 */ 00713 XQUERY_ERROR 00714 (*get_copy_ns_mode)(XQC_StaticContext context, 00715 preserve_mode_t* aPreserve, 00716 inherit_mode_t* aInherit ); 00717 00718 /** 00719 * Sets the base uri in the given static context. 00720 * 00721 * \param context The XQC_StaticContext that this function pointer is a member of 00722 * \param base_uri The base uri to set in the given context. 00723 * 00724 * \retval ::XQC_NO_ERROR 00725 * \retval ::XQC_INTERNAL_ERROR 00726 */ 00727 XQUERY_ERROR 00728 (*set_base_uri)(XQC_StaticContext context, const char* base_uri ); 00729 00730 /** 00731 * Returns the base uri that is set in the given static context. 00732 * The returned base uri is only valid as long as the corresponding static context 00733 * is valid. 00734 * 00735 * \param context The XQC_StaticContext that this function pointer is a member of 00736 * \param[out] base_uri The base uri that is set in the given context. 00737 * 00738 * \retval ::XQC_NO_ERROR 00739 * \retval ::XQC_INTERNAL_ERROR 00740 */ 00741 XQUERY_ERROR 00742 (*get_base_uri)(XQC_StaticContext context, const char** base_uri); 00743 00744 /** 00745 * Register an external function that can be called within a query. 00746 * One external function consists of three function parameters, i.e. init, next, and release. 00747 * 00748 * \param context The XQC_StaticContext that this function pointer is a member of 00749 * \param uri The URI of the external function to add. 00750 * \param localname The localname of the function to add. 00751 * \param init A callback function pointer that is called once when the external function 00752 * is initialized. The init function gets the global_user_data pointer 00753 * as parameter. 00754 * \param next A callback function pointer that is called each time the corresponding 00755 * XQuery function is executed. 00756 * \param release A callback function pointer that is called once when the external function 00757 * is deinitialized. 00758 * \param global_user_data User specific data that is passed to the init function as a parameter. 00759 * 00760 * \retval ::XQC_NO_ERROR 00761 * \retval ::API0019_FUNCTION_ALREADY_REGISTERED, 00762 * \retval ::XQC_INTERNAL_ERROR 00763 */ 00764 XQUERY_ERROR 00765 (*register_external_function)(XQC_StaticContext context, 00766 const char* uri, 00767 const char* localname, 00768 external_function_init init, 00769 external_function_next next, 00770 external_function_release release, 00771 void* global_user_data); 00772 00773 /** 00774 * Called to free the resources associated with the XQC_StaticContext. 00775 * 00776 * \param context The XQC_StaticContext that this function pointer is a member of 00777 */ 00778 void 00779 (*free)(XQC_StaticContext context); 00780 00781 /** 00782 * for internal use only 00783 */ 00784 void* data; 00785 }; 00786 00787 /** 00788 * An object of the type ::XQC_DynamicContext contains the information that is available at the 00789 * time the query is executed. It contains the information that is defined in the %XQuery 00790 * specification (see http://www.w3.org/TR/xquery/#eval_context). 00791 * An instance of this struct can be retrieved by calling the <code>get_dynamic_context</code> function 00792 * of an ::XQC_Query object. 00793 */ 00794 struct XQC_DynamicContext_s 00795 { 00796 /** 00797 * Sets the context item to the given ::XQC_Item. 00798 * 00799 * \param context The XQC_DynamicContext that this function pointer is a member of 00800 * \param value The XQC_Item for the context item. 00801 * 00802 * \retval ::XQC_NO_ERROR 00803 * \retval ::XQC_INTERNAL_ERROR 00804 */ 00805 XQUERY_ERROR 00806 (*set_context_item) (XQC_DynamicContext context, XQC_Item value); 00807 00808 /** 00809 * Sets the context item to the document given by the FILE pointer. 00810 * The provided document is accessible by the provided doc_uri. 00811 * 00812 * \param context The XQC_DynamicContext that this function pointer is a member of 00813 * \param doc_uri The URI referencing the given document 00814 * \param document The document to which the context item should be set as a FILE pointer. 00815 * 00816 * \retval ::XQC_NO_ERROR 00817 * \retval ::XQP0016_LOADER_IO_ERROR, 00818 * \retval ::XQP0017_LOADER_PARSING_ERROR, 00819 * \retval ::XQC_INTERNAL_ERROR 00820 */ 00821 XQUERY_ERROR 00822 (*set_context_document)(XQC_DynamicContext context, const char* doc_uri, FILE* document); 00823 00824 /** 00825 * Sets the external variable to the value given. 00826 * 00827 * \param context The XQC_DynamicContext that this function pointer is a member of 00828 * \param qname The qname of the external variable to set 00829 * \param value The XQC_Item value for the variable. 00830 * 00831 * \retval ::XQC_NO_ERROR 00832 * \retval ::XQC_INTERNAL_ERROR 00833 */ 00834 XQUERY_ERROR 00835 (*set_variable_item)(XQC_DynamicContext context, const char* qname, XQC_Item value); 00836 00837 /** 00838 * Sets the external variable to the sequence given. 00839 * 00840 * \param context The XQC_DynamicContext that this function pointer is a member of 00841 * \param qname The qname of the external variable to set 00842 * \param value The XQC_Sequence value for the variable. 00843 * 00844 * \retval ::XQC_NO_ERROR 00845 * \retval ::XQC_INTERNAL_ERROR 00846 */ 00847 XQUERY_ERROR 00848 (*set_variable_sequence)(XQC_DynamicContext context, const char* qname, XQC_Sequence value); 00849 00850 /** 00851 * Sets the external variable to the document given by the FILE pointer. 00852 * 00853 * \param context The XQC_DynamicContext that this function pointer is a member of 00854 * \param var_qname The qname of the external variable to set 00855 * \param doc_uri The URI referencing the given document 00856 * \param document The document to which the context item should be set as a FILE pointer. 00857 * 00858 * \retval ::XQC_NO_ERROR 00859 * \retval ::XQP0016_LOADER_IO_ERROR, 00860 * \retval ::XQP0017_LOADER_PARSING_ERROR, 00861 * \retval ::XQC_INTERNAL_ERROR 00862 */ 00863 XQUERY_ERROR 00864 (*set_variable_document)(XQC_DynamicContext context, const char* var_qname, const char* doc_uri, FILE* document); 00865 00866 /** 00867 * Sets the implicit timezone parameter. 00868 * 00869 * \param context The XQC_DynamicContext that this function pointer is a member of 00870 * \param timezone The implicit timezone to set 00871 * 00872 * \retval ::XQC_NO_ERROR 00873 * \retval ::XQC_INTERNAL_ERROR 00874 */ 00875 XQUERY_ERROR 00876 (*set_implicit_timezone)(XQC_DynamicContext context, int timezone); 00877 00878 /** 00879 * Defines the value of the default collection that is used when calling the 00880 * fn:collection function without a parameter. 00881 * 00882 * \param context The XQC_DynamicContext that this function pointer is a member of 00883 * \param collection_uri the URI of the collection used by the fn:collection function. 00884 * \retval ::XQC_NO_ERROR 00885 * \retval ::XQC_INTERNAL_ERROR 00886 */ 00887 XQUERY_ERROR 00888 (*set_default_collection)(XQC_DynamicContext context, XQC_Item collection_uri); 00889 00890 /** 00891 * Called to free the resources associated with the XQC_DynamicContext. 00892 * 00893 * \param context The XQC_DynamicContext that this function pointer is a member of 00894 */ 00895 void 00896 (*free)(XQC_DynamicContext context); 00897 00898 /** 00899 * for internal use only 00900 */ 00901 void* data; 00902 }; 00903 00904 /** 00905 * This struct is Zorba's representation of an Item as defined in the 00906 * XQuery 1.0 and XPath 2.0 Data Model (XDM); see http://www.w3.org/TR/xpath-datamodel/. 00907 * 00908 * Instances of the XDM are a sequence, i.e. an ordered collection of zero or more items. 00909 * In the Zorba API, a sequence is represented by the XQC_Sequence struct. 00910 * 00911 * The Item class is the union of all XQuery node and atomic types. 00912 * The class provides functions to access the information of an Item. Note that not 00913 * all functions are defined on every Item kind. If a function is called on an Item that 00914 * does not provide the function called, an XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE error 00915 * is raised. 00916 * 00917 * A new atomic Item can be created using the ItemFactory. A new node Item should be created 00918 * by the result of a query. 00919 */ 00920 struct XQC_Item_s 00921 { 00922 /** 00923 * The string value is the string that is extracted by calling the fn:string function 00924 * on the Item (see http://www.w3.org/TR/xpath-functions/#func-string). 00925 * Note that this function is available for all types of Items. 00926 * 00927 * \param item The XQC_Item that this function pointer is a member of 00928 * \param[out] string_value The string-value of the given item. 00929 * This string is valid as long as the given item is valid. 00930 * 00931 * \retval ::XQC_NO_ERROR 00932 * \retval ::XQP0019_INTERNAL_ERROR 00933 * \retval ::XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE 00934 */ 00935 XQUERY_ERROR 00936 (*string_value)(XQC_Item item, const char** string_value); 00937 00938 /** 00939 * Get the (optional) value of a QName's prefix. 00940 * Note that this function is only available for Items of type QName. 00941 * 00942 * \param item The XQC_Item that this function pointer is a member of 00943 * \param[out] prefix The prefix of the given QName item. 00944 * This string is valid as long as the given item is valid. 00945 * 00946 * \retval ::XQC_NO_ERROR 00947 * \retval ::XQP0019_INTERNAL_ERROR 00948 * \retval ::XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE 00949 */ 00950 XQUERY_ERROR 00951 (*prefix)(XQC_Item item, const char** prefix); 00952 00953 /** 00954 * Get the (optional) value of a QName's namespace. 00955 * Note that this function is only available for Items of type QName. 00956 * 00957 * \param item The XQC_Item that this function pointer is a member of 00958 * \param[out] namespace The namespace of the given QName item. 00959 * This string is valid as long as the given item is valid. 00960 * 00961 * \retval ::XQC_NO_ERROR 00962 * \retval ::XQP0019_INTERNAL_ERROR 00963 * \retval ::XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE 00964 */ 00965 XQUERY_ERROR 00966 (*ns)(XQC_Item item, const char** ns); 00967 00968 /** 00969 * Get the value of a QName's localname. 00970 * Note that this function is only available for Items of type QName. 00971 * 00972 * \param item The XQC_Item that this function pointer is a member of 00973 * \param[out] localname The localname of the given QName item. 00974 * This string is valid as long as the given item is valid. 00975 * 00976 * \retval ::XQC_NO_ERROR 00977 * \retval ::XQP0019_INTERNAL_ERROR 00978 * \retval ::XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE 00979 */ 00980 XQUERY_ERROR 00981 (*localname)(XQC_Item item, const char** local_name); 00982 00983 /** 00984 * Get the bool value of the boolean Item. 00985 * Note that this function is only available for Items of type boolean. 00986 * 00987 * \param item The XQC_Item that this function pointer is a member of 00988 * \param[out] bool_value 1 if the boolean value of the given item is true, 0 otherwise. 00989 * 00990 * \retval ::XQC_NO_ERROR 00991 * \retval ::XQP0019_INTERNAL_ERROR 00992 * \retval ::XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE 00993 */ 00994 XQUERY_ERROR 00995 (*boolean_value)(XQC_Item item, int* bool_value); 00996 00997 /** 00998 * Check if the value of the Item is not a number (NaN). 00999 * Note that this function is implemented for all item types but may only return 01000 * 1 for a numeric item (e.g. Double or Float). 01001 * 01002 * \param item The XQC_Item that this function pointer is a member of 01003 * \param[out] is_nan 1 if the given item is not a number, 0 otherwise. 01004 * 01005 * \retval ::XQC_NO_ERROR 01006 * \retval ::XQP0019_INTERNAL_ERROR 01007 * \retval ::XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE 01008 */ 01009 XQUERY_ERROR 01010 (*nan)(XQC_Item item, int* is_nan); 01011 01012 /** 01013 Check if the value of the Item is positive or negative infinity. 01014 * Note that this function is only available for numeric items (e.g. Double or Float). 01015 * 01016 * \param item The XQC_Item that this function pointer is a member of 01017 * \param[out] inf 1 if the given item is +/-INF, 0 otherwise. 01018 * 01019 * \retval ::XQC_NO_ERROR 01020 * \retval ::XQP0019_INTERNAL_ERROR 01021 * \retval ::XQP0024_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE 01022 */ 01023 XQUERY_ERROR 01024 (*pos_or_neg_inf)(XQC_Item item, int* inf); 01025 01026 /** 01027 * Called to free the resources associated with the XQC_Item. 01028 * 01029 * \param item The XQC_Item that this function pointer is a member of 01030 */ 01031 void 01032 (*free)(XQC_Item item); 01033 01034 /** 01035 * for internal use only 01036 */ 01037 void* data; 01038 }; 01039 01040 /** 01041 * An instance of this class can be obtained by calling <code>item_factory</code> function 01042 * of an ::XQC_Implementation object. 01043 * 01044 * Each <code>create_XXX</code> function of this struct creates an ::XQC_Item of an XML Schema item. 01045 * Each of the functions takes either NULL or a valid XQC_Item wrapper. The latter is created 01046 * by calling <code>XQC_Implementation::create_item</code>. In both cases, the user is responsible 01047 * for freeing the object by calling the XQC_Item::free() function. 01048 */ 01049 struct XQC_ItemFactory_s 01050 { 01051 /** 01052 * Creates a String Item see [http://www.w3.org/TR/xmlschema-2/#string]. 01053 * 01054 * \param factory The XQC_ItemFactory that this function pointer is a member of 01055 * \param str The string as a char pointer. 01056 * \param[out] item The item to create. This can either be a wrapper created using 01057 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01058 * 01059 * \retval ::XQC_NO_ERROR 01060 * \retval ::XQP0019_INTERNAL_ERROR 01061 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01062 */ 01063 XQUERY_ERROR 01064 (*create_string)(XQC_ItemFactory factory, const char* str, XQC_Item_Ref item); 01065 01066 /** 01067 * Creates an AnyURI Item see [http://www.w3.org/TR/xmlschema-2/#anyURI] 01068 * 01069 * \param factory The XQC_ItemFactory that this function pointer is a member of 01070 * \param str The uri as a char pointer. 01071 * \param[out] item The item to create. This can either be a wrapper created using 01072 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01073 * 01074 * \retval ::XQC_NO_ERROR 01075 * \retval ::XQP0019_INTERNAL_ERROR 01076 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01077 */ 01078 XQUERY_ERROR 01079 (*create_anyuri)(XQC_ItemFactory factory, const char* str, XQC_Item_Ref item); 01080 01081 /** 01082 * Creates a QName Item see [http://www.w3.org/TR/xmlschema-2/#QName] 01083 * 01084 * \param factory The XQC_ItemFactory that this function pointer is a member of 01085 * \param str The uri as a char pointer. 01086 * \param localname The localname as a char pointer. 01087 * \param[out] item The item to create. This can either be a wrapper created using 01088 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01089 * 01090 * \retval ::XQC_NO_ERROR 01091 * \retval ::XQP0019_INTERNAL_ERROR 01092 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01093 */ 01094 XQUERY_ERROR 01095 (*create_qname2)(XQC_ItemFactory factory, 01096 const char* uri, 01097 const char* localname, 01098 XQC_Item_Ref item); 01099 01100 /** 01101 * Creates a QName Item see [http://www.w3.org/TR/xmlschema-2/#QName] 01102 * 01103 * \param factory The XQC_ItemFactory that this function pointer is a member of 01104 * \param str The uri as a char pointer. 01105 * \param prefix The prefix as a char pointer. 01106 * \param localname The localname as a char pointer. 01107 * \param[out] item The item to create. This can either be a wrapper created using 01108 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01109 * 01110 * \retval ::XQC_NO_ERROR 01111 * \retval ::XQP0019_INTERNAL_ERROR 01112 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01113 */ 01114 XQUERY_ERROR 01115 (*create_qname3)(XQC_ItemFactory factory, 01116 const char* uri, 01117 const char* prefix, 01118 const char* localname, 01119 XQC_Item_Ref item); 01120 01121 /** 01122 * Creates a Boolean Item see [http://www.w3.org/TR/xmlschema-2/#bool] 01123 * 01124 * \param factory The XQC_ItemFactory that this function pointer is a member of 01125 * \param boolean 0 for a boolean <code>false</code> boolean item, 1 otherwise. 01126 * \param[out] item The item to create. This can either be a wrapper created using 01127 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01128 * 01129 * \retval ::XQC_NO_ERROR 01130 * \retval ::XQP0019_INTERNAL_ERROR 01131 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01132 */ 01133 XQUERY_ERROR 01134 (*create_boolean)(XQC_ItemFactory factory, int boolean, XQC_Item_Ref item); 01135 01136 /** 01137 * Creates a NCName Item see [http://www.w3.org/TR/xmlschema-2/#NCName] 01138 * 01139 * \param factory The XQC_ItemFactory that this function pointer is a member of 01140 * \param ncname The NCName as a char pointer. 01141 * \param[out] item The item to create. This can either be a wrapper created using 01142 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01143 * 01144 * \retval ::XQC_NO_ERROR 01145 * \retval ::XQP0019_INTERNAL_ERROR 01146 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01147 */ 01148 XQUERY_ERROR 01149 (*create_ncname)(XQC_ItemFactory factory, const char* ncname, XQC_Item_Ref item); 01150 01151 01152 /** 01153 * Creates a Base64Binary Item see [http://www.w3.org/TR/xmlschema-2/#base64Binary] 01154 * 01155 * \param factory The XQC_ItemFactory that this function pointer is a member of 01156 * \param binary_data The binary data as a char pointer. 01157 * \param letter The length of the binary data. 01158 * \param[out] item The item to create. This can either be a wrapper created using 01159 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01160 * 01161 * \retval ::XQC_NO_ERROR 01162 * \retval ::XQP0019_INTERNAL_ERROR 01163 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01164 */ 01165 XQUERY_ERROR 01166 (*create_base64binary)(XQC_ItemFactory factory, const char* binary_data, size_t length, XQC_Item_Ref item ); 01167 01168 /** 01169 * Creates a Decimal Item see [http://www.w3.org/TR/xmlschema-2/#decimal] 01170 * 01171 * \param factory The XQC_ItemFactory that this function pointer is a member of 01172 * \param value The value as a doule 01173 * \param[out] item The item to create. This can either be a wrapper created using 01174 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01175 * 01176 * \retval ::XQC_NO_ERROR 01177 * \retval ::XQP0019_INTERNAL_ERROR 01178 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01179 */ 01180 XQUERY_ERROR 01181 (*create_decimal)(XQC_ItemFactory factory, double value, XQC_Item_Ref item ); 01182 01183 /** 01184 * Creates a Decimal Item see [http://www.w3.org/TR/xmlschema-2/#decimal] 01185 * 01186 * \param factory The XQC_ItemFactory that this function pointer is a member of 01187 * \param value The value as a char pointer. 01188 * \param[out] item The item to create. This can either be a wrapper created using 01189 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01190 * 01191 * \retval ::XQC_NO_ERROR 01192 * \retval ::XQP0019_INTERNAL_ERROR 01193 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01194 */ 01195 XQUERY_ERROR 01196 (*create_decimal_char)(XQC_ItemFactory factory, const char* value, XQC_Item_Ref item ); 01197 01198 /** 01199 * Creates an Integer Item see [http://www.w3.org/TR/xmlschema-2/#integer] 01200 * 01201 * \param factory The XQC_ItemFactory that this function pointer is a member of 01202 * \param integer_value The value as a long long. 01203 * \param[out] item The item to create. This can either be a wrapper created using 01204 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01205 * 01206 * \retval ::XQC_NO_ERROR 01207 * \retval ::XQP0019_INTERNAL_ERROR 01208 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01209 */ 01210 XQUERY_ERROR 01211 (*create_integer)(XQC_ItemFactory factory, long long integer_value, XQC_Item_Ref item ); 01212 01213 /** 01214 * Creates an Integer Item see [http://www.w3.org/TR/xmlschema-2/#integer] 01215 * 01216 * \param factory The XQC_ItemFactory that this function pointer is a member of 01217 * \param integer_value The value as a char pointer. 01218 * \param[out] item The item to create. This can either be a wrapper created using 01219 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01220 * 01221 * \retval ::XQC_NO_ERROR 01222 * \retval ::XQP0019_INTERNAL_ERROR 01223 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01224 */ 01225 XQUERY_ERROR 01226 (*create_integer_char)(XQC_ItemFactory factory, const char* integer_value, XQC_Item_Ref item ); 01227 01228 /** 01229 * Creates a Long Item see [http://www.w3.org/TR/xmlschema-2/#long] 01230 * 01231 * \param factory The XQC_ItemFactory that this function pointer is a member of 01232 * \param long_value The value as a long long. 01233 * \param[out] item The item to create. This can either be a wrapper created using 01234 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01235 * 01236 * \retval ::XQC_NO_ERROR 01237 * \retval ::XQP0019_INTERNAL_ERROR 01238 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01239 */ 01240 XQUERY_ERROR 01241 (*create_long)(XQC_ItemFactory factory, long long long_value, XQC_Item_Ref item ); 01242 01243 /** 01244 * Creates a Int Item see [http://www.w3.org/TR/xmlschema-2/#int] 01245 * 01246 * \param factory The XQC_ItemFactory that this function pointer is a member of 01247 * \param int_value The value as an int. 01248 * \param[out] item The item to create. This can either be a wrapper created using 01249 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01250 * 01251 * \retval ::XQC_NO_ERROR 01252 * \retval ::XQP0019_INTERNAL_ERROR 01253 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01254 */ 01255 XQUERY_ERROR 01256 (*create_int)(XQC_ItemFactory factory, int int_value, XQC_Item_Ref item ); 01257 01258 /** 01259 * Creates a Short Item see [http://www.w3.org/TR/xmlschema-2/#short] 01260 * 01261 * \param factory The XQC_ItemFactory that this function pointer is a member of 01262 * \param short_value The value as a short. 01263 * \param[out] item The item to create. This can either be a wrapper created using 01264 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01265 * 01266 * \retval ::XQC_NO_ERROR 01267 * \retval ::XQP0019_INTERNAL_ERROR 01268 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01269 */ 01270 XQUERY_ERROR 01271 (*create_short)(XQC_ItemFactory factory, short short_value, XQC_Item_Ref item ); 01272 01273 /** 01274 * Creates a Byte Item see [http://www.w3.org/TR/xmlschema-2/#byte] 01275 * 01276 * \param factory The XQC_ItemFactory that this function pointer is a member of 01277 * \param byte_value The byte value as a char. 01278 * \param[out] item The item to create. This can either be a wrapper created using 01279 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01280 * 01281 * \retval ::XQC_NO_ERROR 01282 * \retval ::XQP0019_INTERNAL_ERROR 01283 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01284 */ 01285 XQUERY_ERROR 01286 (*create_byte)(XQC_ItemFactory factory, char byte_value, XQC_Item_Ref item ); 01287 01288 /** 01289 * Creates a Date Item see [http://www.w3.org/TR/xmlschema-2/#date] 01290 * 01291 * \param factory The XQC_ItemFactory that this function pointer is a member of 01292 * \param date_value The date value as a char pointer. 01293 * \param[out] item The item to create. This can either be a wrapper created using 01294 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01295 * 01296 * \retval ::XQC_NO_ERROR 01297 * \retval ::XQP0019_INTERNAL_ERROR 01298 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01299 */ 01300 XQUERY_ERROR 01301 (*create_date_char)(XQC_ItemFactory factory, const char* date_value, XQC_Item_Ref item ); 01302 01303 /** 01304 * Creates a Date Item see [http://www.w3.org/TR/xmlschema-2/#date] 01305 * 01306 * \param factory The XQC_ItemFactory that this function pointer is a member of 01307 * \param year The year value as a short. 01308 * \param month The month value as a short. 01309 * \param day The day value as a short. 01310 * \param[out] item The item to create. This can either be a wrapper created using 01311 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01312 * 01313 * \retval ::XQC_NO_ERROR 01314 * \retval ::XQP0019_INTERNAL_ERROR 01315 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01316 */ 01317 XQUERY_ERROR 01318 (*create_date)(XQC_ItemFactory factory, short year, short month, short day, XQC_Item_Ref item ); 01319 01320 /** 01321 * Creates a DateTime Item see [http://www.w3.org/TR/xmlschema-2/#dateTime] 01322 * 01323 * \param factory The XQC_ItemFactory that this function pointer is a member of 01324 * \param year The year value as a short. 01325 * \param month The month value as a short. 01326 * \param day The day value as a short. 01327 * \param hour The hour value as a short. 01328 * \param minute The minute value as a short. 01329 * \param seconds The seconds value as a short. 01330 * \param timezone_hours The timezone as a short. 01331 * \param[out] item The item to create. This can either be a wrapper created using 01332 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01333 * 01334 * \retval ::XQC_NO_ERROR 01335 * \retval ::XQP0019_INTERNAL_ERROR 01336 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01337 */ 01338 XQUERY_ERROR 01339 (*create_datetime)(XQC_ItemFactory factory, short year, short month, short day, 01340 short hour, short minute, double seconds, short timezone_hours, XQC_Item_Ref item ); 01341 01342 /** 01343 * Creates a DateTime Item see [http://www.w3.org/TR/xmlschema-2/#dateTime] 01344 * 01345 * \param factory The XQC_ItemFactory that this function pointer is a member of 01346 * \param datetime_value The string representation of the datetime value as a char pointer 01347 * (for example, 2002-10-10T12:00:00-05:00). 01348 * \param[out] item The item to create. This can either be a wrapper created using 01349 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01350 * 01351 * \retval ::XQC_NO_ERROR 01352 * \retval ::XQP0019_INTERNAL_ERROR 01353 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01354 */ 01355 XQUERY_ERROR 01356 (*create_datetime_char)(XQC_ItemFactory factory, const char* datetime_value, XQC_Item_Ref item ); 01357 01358 /** 01359 * Creates a Double Item see [http://www.w3.org/TR/xmlschema-2/#double] 01360 * 01361 * \param factory The XQC_ItemFactory that this function pointer is a member of 01362 * \param[out] item The item to create. This can either be a wrapper created using 01363 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01364 * 01365 * \retval ::XQC_NO_ERROR 01366 * \retval ::XQP0019_INTERNAL_ERROR 01367 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01368 */ 01369 XQUERY_ERROR 01370 (*create_double)(XQC_ItemFactory factory, double value, XQC_Item_Ref item ); 01371 01372 /** 01373 * Creates a Double Item see [http://www.w3.org/TR/xmlschema-2/#double] 01374 * 01375 * \param factory The XQC_ItemFactory that this function pointer is a member of 01376 * \param value The value as a char pointer. 01377 * \param[out] item The item to create. This can either be a wrapper created using 01378 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01379 * 01380 * \retval ::XQC_NO_ERROR 01381 * \retval ::XQP0019_INTERNAL_ERROR 01382 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01383 */ 01384 XQUERY_ERROR 01385 (*create_double_char)(XQC_ItemFactory factory, const char* value, XQC_Item_Ref item ); 01386 01387 /** 01388 * Creates a Duration Item see [http://www.w3.org/TR/xmlschema-2/#duration] 01389 * 01390 * \param factory The XQC_ItemFactory that this function pointer is a member of 01391 * \param year The year value as a short. 01392 * \param month The month value as a short. 01393 * \param day The day value as a short. 01394 * \param hour The hour value as a short. 01395 * \param minute The minute value as a short. 01396 * \param seconds The seconds value as a short. 01397 * \param[out] item The item to create. This can either be a wrapper created using 01398 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01399 * 01400 * \retval ::XQC_NO_ERROR 01401 * \retval ::XQP0019_INTERNAL_ERROR 01402 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01403 */ 01404 XQUERY_ERROR 01405 (*create_duration)(XQC_ItemFactory factory, short year, short months, short days, 01406 short hours, short minutes, double seconds, XQC_Item_Ref item ); 01407 01408 /** 01409 * Creates a Float Item see [http://www.w3.org/tr/xmlschema-2/#float] 01410 * 01411 * \param factory The XQC_ItemFactory that this function pointer is a member of 01412 * \param value The float value as a char pointer. 01413 * \param[out] item The item to create. This can either be a wrapper created using 01414 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01415 * 01416 * \retval ::XQC_NO_ERROR 01417 * \retval ::XQP0019_INTERNAL_ERROR 01418 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01419 */ 01420 XQUERY_ERROR 01421 (*create_float)(XQC_ItemFactory factory, const char* value, XQC_Item_Ref item ); 01422 01423 /** 01424 * Creates a gDay Item see [http://www.w3.org/TR/xmlschema-2/#gDay] 01425 * 01426 * \param factory The XQC_ItemFactory that this function pointer is a member of 01427 * \param day The day value as a short. 01428 * \param[out] item The item to create. This can either be a wrapper created using 01429 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01430 * 01431 * \retval ::XQC_NO_ERROR 01432 * \retval ::XQP0019_INTERNAL_ERROR 01433 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01434 */ 01435 XQUERY_ERROR 01436 (*create_gday)(XQC_ItemFactory factory, short day, XQC_Item_Ref item ); 01437 01438 /** 01439 * Creates a gMonth Item see [http://www.w3.org/TR/xmlschema-2/#gMonth] 01440 * 01441 * \param factory The XQC_ItemFactory that this function pointer is a member of 01442 * \param month The month value as a short. 01443 * \param[out] item The item to create. This can either be a wrapper created using 01444 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01445 * 01446 * \retval ::XQC_NO_ERROR 01447 * \retval ::XQP0019_INTERNAL_ERROR 01448 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01449 */ 01450 XQUERY_ERROR 01451 (*create_gmonth)(XQC_ItemFactory factory, short month, XQC_Item_Ref item ); 01452 01453 /** 01454 * Creates a gMonthDay Item see [http://www.w3.org/TR/xmlschema-2/#gMonthDay] 01455 * 01456 * \param factory The XQC_ItemFactory that this function pointer is a member of 01457 * \param month The month value as a short. 01458 * \param day The day value as a short. 01459 * \param[out] item The item to create. This can either be a wrapper created using 01460 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01461 * 01462 * \retval ::XQC_NO_ERROR 01463 * \retval ::XQP0019_INTERNAL_ERROR 01464 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01465 */ 01466 XQUERY_ERROR 01467 (*create_gmonthday)(XQC_ItemFactory factory, short month, short day, XQC_Item_Ref item ); 01468 01469 /** 01470 * Creates a gYear Item see [http://www.w3.org/TR/xmlschema-2/#gYear] 01471 * 01472 * \param factory The XQC_ItemFactory that this function pointer is a member of 01473 * \param year The year value as a short. 01474 * \param[out] item The item to create. This can either be a wrapper created using 01475 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01476 * 01477 * \retval ::XQC_NO_ERROR 01478 * \retval ::XQP0019_INTERNAL_ERROR 01479 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01480 */ 01481 XQUERY_ERROR 01482 (*create_gyear)(XQC_ItemFactory factory, short year, XQC_Item_Ref item ); 01483 01484 /** 01485 * Creates a gYearMonth Item see [http://www.w3.org/TR/xmlschema-2/#gYearMonth] 01486 * 01487 * \param factory The XQC_ItemFactory that this function pointer is a member of 01488 * \param year The year value as a short. 01489 * \param month The month value as a short. 01490 * \param[out] item The item to create. This can either be a wrapper created using 01491 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01492 * 01493 * \retval ::XQC_NO_ERROR 01494 * \retval ::XQP0019_INTERNAL_ERROR 01495 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01496 */ 01497 XQUERY_ERROR 01498 (*create_gyearmonth)(XQC_ItemFactory factory, short year, short month, XQC_Item_Ref item ); 01499 01500 /** 01501 * Creates a HexBinary Item see [http://www.w3.org/TR/xmlschema-2/#hexBinary] 01502 * 01503 * \param factory The XQC_ItemFactory that this function pointer is a member of 01504 * \param hex_data The hex data as a char pointer. 01505 * \param size The size of the hex data. 01506 * \param[out] item The item to create. This can either be a wrapper created using 01507 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01508 * 01509 * \retval ::XQC_NO_ERROR 01510 * \retval ::XQP0019_INTERNAL_ERROR 01511 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01512 */ 01513 XQUERY_ERROR 01514 (*create_hexbinary)(XQC_ItemFactory factory, const char* hex_data, size_t size, XQC_Item_Ref item ); 01515 01516 /** 01517 * Creates a negativeInteger Item see [http://www.w3.org/TR/xmlschema-2/#negativeInteger] 01518 * 01519 * \param factory The XQC_ItemFactory that this function pointer is a member of 01520 * \param value The negative integer as a long long value. 01521 * \param[out] item The item to create. This can either be a wrapper created using 01522 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01523 * 01524 * \retval ::XQC_NO_ERROR 01525 * \retval ::XQP0019_INTERNAL_ERROR 01526 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01527 */ 01528 XQUERY_ERROR 01529 (*create_negativeinteger)(XQC_ItemFactory factory, long long value, XQC_Item_Ref item ); 01530 01531 /** 01532 * Creates a nonNegativeInteger Item see [http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger] 01533 * 01534 * \param factory The XQC_ItemFactory that this function pointer is a member of 01535 * \param value The non-negative integer as an unsigned long long value. 01536 * \param[out] item The item to create. This can either be a wrapper created using 01537 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01538 * 01539 * \retval ::XQC_NO_ERROR 01540 * \retval ::XQP0019_INTERNAL_ERROR 01541 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01542 */ 01543 XQUERY_ERROR 01544 (*create_nonnegativeinteger)(XQC_ItemFactory factory, unsigned long long value, XQC_Item_Ref item ); 01545 01546 /** 01547 * Creates a nonPositiveInteger Item see [http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger] 01548 * 01549 * \param factory The XQC_ItemFactory that this function pointer is a member of 01550 * \param value The non-positive integer as a long long value. 01551 * \param[out] item The item to create. This can either be a wrapper created using 01552 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01553 * 01554 * \retval ::XQC_NO_ERROR 01555 * \retval ::XQP0019_INTERNAL_ERROR 01556 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01557 */ 01558 XQUERY_ERROR 01559 (*create_nonpositiveinteger)(XQC_ItemFactory factory, long long value, XQC_Item_Ref item ); 01560 01561 /** 01562 * Creates a positiveInteger Item see [http://www.w3.org/TR/xmlschema-2/#positiveInteger] 01563 * 01564 * \param factory The XQC_ItemFactory that this function pointer is a member of 01565 * \param value The positive integer as an unsigned long long value. 01566 * \param[out] item The item to create. This can either be a wrapper created using 01567 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01568 * 01569 * \retval ::XQC_NO_ERROR 01570 * \retval ::XQP0019_INTERNAL_ERROR 01571 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01572 */ 01573 XQUERY_ERROR 01574 (*create_positiveinteger)(XQC_ItemFactory factory, unsigned long long value, XQC_Item_Ref item ); 01575 01576 /** 01577 * Creates a Time Item see [http://www.w3.org/TR/xmlschema-2/#time] 01578 * 01579 * \param factory The XQC_ItemFactory that this function pointer is a member of 01580 * \param value The time as a char pointer. 01581 * \param[out] item The item to create. This can either be a wrapper created using 01582 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01583 * 01584 * \retval ::XQC_NO_ERROR 01585 * \retval ::XQP0019_INTERNAL_ERROR 01586 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01587 */ 01588 XQUERY_ERROR 01589 (*create_time_char)(XQC_ItemFactory factory, const char* value, XQC_Item_Ref item ); 01590 01591 /** 01592 * Creates a Time Item see [http://www.w3.org/TR/xmlschema-2/#time] 01593 * 01594 * \param factory The XQC_ItemFactory that this function pointer is a member of 01595 * \param hour The hour as a short. 01596 * \param minute The minute as a short. 01597 * \param second The second as a short. 01598 * \param[out] item The item to create. This can either be a wrapper created using 01599 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01600 * 01601 * \retval ::XQC_NO_ERROR 01602 * \retval ::XQP0019_INTERNAL_ERROR 01603 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01604 */ 01605 XQUERY_ERROR 01606 (*create_time)(XQC_ItemFactory factory, short hour, short minute, double second, XQC_Item_Ref item ); 01607 01608 /** 01609 * Creates a Time Item see [http://www.w3.org/TR/xmlschema-2/#time] 01610 * 01611 * \param factory The XQC_ItemFactory that this function pointer is a member of 01612 * \param hour The hour as a short. 01613 * \param minute The minute as a short. 01614 * \param second The second as a double. 01615 * \param timezone_hours The timezone hours as a short. 01616 * \param[out] item The item to create. This can either be a wrapper created using 01617 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01618 * 01619 * \retval ::XQC_NO_ERROR 01620 * \retval ::XQP0019_INTERNAL_ERROR 01621 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01622 */ 01623 XQUERY_ERROR 01624 (*create_time_timezone)(XQC_ItemFactory factory, 01625 short hour, 01626 short minute, 01627 double second, 01628 short timezone_hours, 01629 XQC_Item_Ref item ); 01630 01631 /** 01632 * Creates an Unsigned Byte Item see [http://www.w3.org/TR/xmlschema-2/#unsignedByte] 01633 * 01634 * \param factory The XQC_ItemFactory that this function pointer is a member of 01635 * \param value The unsigned byte value as an unsigned char. 01636 * \param[out] item The item to create. This can either be a wrapper created using 01637 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01638 * 01639 * \retval ::XQC_NO_ERROR 01640 * \retval ::XQP0019_INTERNAL_ERROR 01641 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01642 */ 01643 XQUERY_ERROR 01644 (*create_unsignedbyte)(XQC_ItemFactory factory, const unsigned char value, XQC_Item_Ref item ); 01645 01646 /** 01647 * Creates an unsigned int Item see [http://www.w3.org/TR/xmlschema-2/#unsignedInt] 01648 * 01649 * \param factory The XQC_ItemFactory that this function pointer is a member of 01650 * \param value The unsigned int value as an unsigned int. 01651 * \param[out] item The item to create. This can either be a wrapper created using 01652 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01653 * 01654 * \retval ::XQC_NO_ERROR 01655 * \retval ::XQP0019_INTERNAL_ERROR 01656 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01657 */ 01658 XQUERY_ERROR 01659 (*create_unsignedint)(XQC_ItemFactory factory, unsigned int value, XQC_Item_Ref item ); 01660 01661 /** 01662 * Creates an unsignedLong Item see [http://www.w3.org/TR/xmlschema-2/#unsignedLong] 01663 * 01664 * \param factory The XQC_ItemFactory that this function pointer is a member of 01665 * \param value The unsigned long value as an unsigned long long. 01666 * \param[out] item The item to create. This can either be a wrapper created using 01667 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01668 * 01669 * \retval ::XQC_NO_ERROR 01670 * \retval ::XQP0019_INTERNAL_ERROR 01671 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01672 */ 01673 XQUERY_ERROR 01674 (*create_unsignedlong)(XQC_ItemFactory factory, unsigned long long value, XQC_Item_Ref item ); 01675 01676 /** 01677 * Creates a unsignedShort Item see [http://www.w3.org/TR/xmlschema-2/#unsignedShort] 01678 * 01679 * \param factory The XQC_ItemFactory that this function pointer is a member of 01680 * \param value The unsigned short value as an unsigned short. 01681 * \param[out] item The item to create. This can either be a wrapper created using 01682 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01683 * 01684 * \retval ::XQC_NO_ERROR 01685 * \retval ::XQP0019_INTERNAL_ERROR 01686 * \retval ::XQP0025_COULD_NOT_CREATE_ITEM 01687 */ 01688 XQUERY_ERROR 01689 (*create_unsignedshort)(XQC_ItemFactory factory, unsigned short value, XQC_Item_Ref item ); 01690 01691 /** 01692 * Called to free the resources associated with the XQC_ItemFactory. 01693 * 01694 * \param factory The XQC_ItemFactory that this function pointer is a member of 01695 * \param[out] item The item to create. This can either be a wrapper created using 01696 * ::XQC_ItemFactory::create_item or a pointer initialized to 0. 01697 */ 01698 void 01699 (*free)(XQC_ItemFactory factory); 01700 01701 /** 01702 * for internal use only 01703 */ 01704 void* data; 01705 }; 01706 01707 /** 01708 * This struct represents an instance of the XQuery 1.0 and XPath 2.0 Data Model (XDM). 01709 * 01710 * See http://www.w3.org/TR/xpath-datamodel/. 01711 */ 01712 struct XQC_Sequence_s 01713 { 01714 01715 /** 01716 * Get the next item of the sequence. 01717 * 01718 * \param sequence The XQC_Sequence_s that this function pointer is a member of 01719 * \param[out] item The item wrapper that should contain the next item if XQ_NO_ERROR is returned 01720 * 01721 * \retval ::XQC_NO_ERROR 01722 * \retval ::XQP0019_INTERNAL_ERROR 01723 * \retval any XQuery type or dynamic error 01724 */ 01725 XQUERY_ERROR 01726 (*next)(XQC_Sequence sequence, XQC_Item item); 01727 01728 /** 01729 * called to free the resources associated with the xqc_itemfactory. 01730 * 01731 * \param sequence the XQC_Sequence that this function pointer is a member of 01732 */ 01733 void 01734 (*free)(XQC_Sequence sequence); 01735 01736 /** 01737 * for internal use only 01738 */ 01739 void* data; 01740 }; 01741 01742 /** 01743 * A Collection is a sequence of Node Items. 01744 * 01745 * Each Collection is created by the XmlDataManager and referenced by a URI. 01746 * The URI can be accessed in a query's fn:collection function. 01747 */ 01748 struct XQC_Collection_s 01749 { 01750 /** 01751 * Get the URI of a collection as an anyURI Item. 01752 * 01753 * \param collection the XQC_Collection_s that this function pointer is a member of 01754 * \param[out] uri_item The uri item of the given collection. The user is responsible 01755 * for freeing the object by calling the XQC_Item::free() function. 01756 * 01757 * \retval ::XQC_NO_ERROR 01758 * \retval ::XQP0019_INTERNAL_ERROR 01759 */ 01760 XQUERY_ERROR 01761 (*get_uri)(XQC_Collection collection, XQC_Item_Ref uri_item); 01762 01763 /** 01764 * Adds a Node Item to the Collection 01765 * 01766 * \param collection the XQC_Collection_s that this function pointer is a member of 01767 * \param node The node item to add to the given collection. 01768 * 01769 * \retval ::XQC_NO_ERROR 01770 * \retval ::XQP0019_INTERNAL_ERROR 01771 * \retval ::API0007_COLLECTION_ITEM_MUST_BE_A_NODE 01772 */ 01773 XQUERY_ERROR 01774 (*add_node)(XQC_Collection collection, XQC_Item node); 01775 01776 /** 01777 * Deletes a Node Item from the given Collection 01778 * 01779 * \param collection the XQC_Collection_s that this function pointer is a member of 01780 * \param node The node item to delete from the given collection. 01781 * 01782 * \retval ::XQC_NO_ERROR 01783 * \retval ::XQP0019_INTERNAL_ERROR 01784 * \retval ::API0007_COLLECTION_ITEM_MUST_BE_A_NODE 01785 */ 01786 XQUERY_ERROR 01787 (*delete_node)(XQC_Collection collection, XQC_Item node); 01788 01789 /** 01790 * Adds a sequence of Node Items to the Collection 01791 * 01792 * \param collection the XQC_Collection_s that this function pointer is a member of 01793 * \param sequence The sequence of node items to add to the given collection. 01794 * 01795 * \retval ::XQC_NO_ERROR 01796 * \retval ::XQP0019_INTERNAL_ERROR 01797 * \retval ::API0007_COLLECTION_ITEM_MUST_BE_A_NODE 01798 */ 01799 XQUERY_ERROR 01800 (*add_sequence)(XQC_Collection collection, XQC_Sequence sequence); 01801 01802 /** 01803 * Adds a document given by the FILE pointer to this collection. 01804 * 01805 * \param collection the XQC_Collection_s that this function pointer is a member of 01806 * \param doc The document to add as a FILE pointer. 01807 * 01808 * \retval ::XQC_NO_ERROR 01809 * \retval ::XQP0016_LOADER_IO_ERROR, 01810 * \retval ::XQP0017_LOADER_PARSING_ERROR, 01811 * \retval ::XQC_INTERNAL_ERROR 01812 */ 01813 XQUERY_ERROR 01814 (*add_document)(XQC_Collection collection, FILE* doc); 01815 01816 /** 01817 * Adds a document given by the char pointer to this collection. 01818 * 01819 * \param collection the XQC_Collection_s that this function pointer is a member of 01820 * \param doc The document to add as a char pointer. 01821 * 01822 * \retval ::XQC_NO_ERROR 01823 * \retval ::XQP0016_LOADER_IO_ERROR, 01824 * \retval ::XQP0017_LOADER_PARSING_ERROR, 01825 * \retval ::XQC_INTERNAL_ERROR 01826 */ 01827 XQUERY_ERROR 01828 (*add_document_char)(XQC_Collection collection, const char* doc); 01829 01830 /** 01831 * called to free the resources associated with the xqc_itemfactory. 01832 * 01833 * \param collection the XQC_Collection that this function pointer is a member of 01834 */ 01835 void 01836 (*free)(XQC_Collection collection); 01837 01838 /** 01839 * for internal use only 01840 */ 01841 void* data; 01842 }; 01843 01844 /** 01845 * Using the XmlDataManager one can manage documents and collections. 01846 * 01847 * The XmlDataManager is a singelton instance. The instance can be accessed by calling 01848 * XQC_Implementation::data_manager. The XmlDataManager is thread-safe. 01849 */ 01850 struct XQC_DataManager_s 01851 { 01852 /** 01853 * This function loads a document from the given FILE pointer. The document 01854 * is identified by the given URI. 01855 * 01856 * \param data_manager The XQC_DataManager that this function pointer is a member of 01857 * \param doc_uri The URI of the document to load. 01858 * \param document The document to load as a FILE pointer. 01859 * 01860 * \retval ::XQC_NO_ERROR 01861 * \retval ::XQP0016_LOADER_IO_ERROR, 01862 * \retval ::XQP0017_LOADER_PARSING_ERROR, 01863 * \retval ::XQC_INTERNAL_ERROR 01864 */ 01865 XQUERY_ERROR 01866 (*load_document)(XQC_DataManager data_manager, const char* doc_uri, FILE* document); 01867 01868 /** 01869 * This function loads a document that is retrieved from the given URI location. The document 01870 * is identified by the given URI. 01871 * 01872 * \param data_manager The XQC_DataManager that this function pointer is a member of 01873 * \param location The URI of the document to load. 01874 * 01875 * \retval ::XQC_NO_ERROR 01876 * \retval ::XQP0016_LOADER_IO_ERROR, 01877 * \retval ::XQP0017_LOADER_PARSING_ERROR, 01878 * \retval ::XQC_INTERNAL_ERROR 01879 */ 01880 XQUERY_ERROR 01881 (*load_document_uri)(XQC_DataManager data_manager, const char* location); 01882 01883 /** 01884 * Get the document identified by the given URI. 01885 * 01886 * \param data_manager The XQC_DataManager that this function pointer is a member of 01887 * \param document_uri The URI of the document to retrieve. 01888 * \param[out] doc The Item of the document to get. The user is responsible 01889 * for freeing the object by calling the XQC_Item::free() function. 01890 * 01891 * \retval ::XQC_NO_ERROR 01892 * \retval ::XQC_INTERNAL_ERROR 01893 */ 01894 XQUERY_ERROR 01895 (*get_document)(XQC_DataManager data_manager, const char* document_uri, XQC_Item_Ref doc); 01896 01897 /* 01898 * Delete the document identified by the given URI. 01899 * 01900 * \param data_manager The XQC_DataManager that this function pointer is a member of 01901 * \param document_uri The URI of the document to delete. 01902 * 01903 * \retval ::XQC_NO_ERROR 01904 * \retval ::XQC_INTERNAL_ERROR 01905 */ 01906 XQUERY_ERROR 01907 (*delete_document)(XQC_DataManager data_manager, const char* document_uri); 01908 01909 /** 01910 * Create a new collection that is identified by the given URI. 01911 * 01912 * \param data_manager The XQC_DataManager that this function pointer is a member of 01913 * \param document_uri The URI of the collection to create. 01914 * \param[out] col The collection to create. The user is responsible 01915 * for freeing the object by calling the XQC_Item::free() function. 01916 * 01917 * \retval ::XQC_NO_ERROR 01918 * \retval ::XQC_INTERNAL_ERROR 01919 */ 01920 XQUERY_ERROR 01921 (*create_collection)(XQC_DataManager data_manager, 01922 const char* collection_uri, 01923 XQC_Collection_Ref col); 01924 01925 /** 01926 * Get the collection that is identified by the given URI. 01927 * 01928 * \param data_manager The XQC_DataManager that this function pointer is a member of 01929 * \param document_uri The URI of the collection to retrieve. 01930 * \param[out] col The collection to retrieve. The user is responsible 01931 * for freeing the object by calling the XQC_Item::free() function. 01932 * 01933 * \retval ::XQC_NO_ERROR 01934 * \retval ::XQC_INTERNAL_ERROR 01935 */ 01936 XQUERY_ERROR 01937 (*get_collection)(XQC_DataManager data_manager, 01938 const char* collection_uri, 01939 XQC_Collection_Ref collection); 01940 01941 /** 01942 * Delete the collection that is identified by the given URI. 01943 * 01944 * \param data_manager The XQC_DataManager that this function pointer is a member of 01945 * \param document_uri The URI of the collection to delete. 01946 * 01947 * \retval ::XQC_NO_ERROR 01948 * \retval ::XQC_INTERNAL_ERROR 01949 */ 01950 XQUERY_ERROR 01951 (*delete_collection)(XQC_DataManager data_manager, const char* collection_uri); 01952 01953 /** 01954 * Called to free the resources associated with the XQC_DataManager. 01955 * 01956 * \param context The XQC_DataManager that this function pointer is a member of 01957 */ 01958 void 01959 (*free)(XQC_DataManager data_manager); 01960 01961 /** 01962 * for internal use only 01963 */ 01964 void* data; 01965 }; 01966 01967 /** 01968 * The ::XQC_OutputStream struct is designed to be passed to an XQC implementation in order 01969 * to return streaming data (i.e. the result of a query). 01970 */ 01971 struct XQC_OutputStream_s 01972 { 01973 /** 01974 * The function is called to provide the streaming result of a query 01975 * in the buffer provided. 01976 * 01977 * \param stream The XQC_OutputStream that this function pointer is a member of 01978 * \param buf The buffer that contains the data 01979 * \param length The length of the contents in the buffer 01980 */ 01981 void 01982 (*write)(XQC_OutputStream stream, const char* buf, unsigned int length); 01983 01984 /** 01985 * Called to free the resources associated with the XQC_OutputStream. 01986 * Free is called by the implementation if it finished writing to the stream. 01987 * 01988 * \param stream The XQC_OutputStream that this function pointer is a member of 01989 * 01990 */ 01991 void 01992 (*free)(XQC_OutputStream stream); 01993 01994 /** 01995 * Can be used for user specific purposes. 01996 */ 01997 void* user_data; 01998 }; 01999 02000 /** 02001 * The ::XQC_InputStream struct is designed to be populated by users for the purpose 02002 * of streaming data into an XQC implementation. 02003 */ 02004 struct XQC_InputStream_s 02005 { 02006 /** 02007 * The function called to read more of the input (e.g. the query). The function should read 02008 * the next chunk of input into the buffer provided, returning the length of the 02009 * data read. 02010 * 02011 * \param stream The XQC_InputStream that this function pointer is a member of 02012 * \param[out] buffer The buffer to read the data into 02013 * \param length The length of the buffer 02014 * 02015 * \return The number of bytes read - this will be less than length if the end of the input is reached 02016 * or -1 if an error occured 02017 * 02018 */ 02019 int 02020 (*read)(XQC_InputStream stream, char* buf, unsigned int length); 02021 02022 /** 02023 * Called to free the resources associated with the XQC_InputStream. 02024 * The free function is called by the implementation if it finished reading from the stream. 02025 * This allows for lazy evaluation without the user needing to know when reading from the 02026 * stream has finished. 02027 * 02028 * \param stream The XQC_InputStream that this function pointer is a member of 02029 * 02030 */ 02031 void 02032 (*free)(XQC_InputStream stream); 02033 02034 /** 02035 * Can be used for user specific purposes. 02036 */ 02037 void* user_data; 02038 }; 02039 02040 /** 02041 * The ::XQC_ErrorHandler struct is designed to be populated by users for the purpose 02042 * of collecting more detailed error messages from an XQC implementation. An XQC_ErrorHandler 02043 * can be set for a query using the XQC_Query::set_error_handler() function. 02044 * 02045 * The XQC_ErrorHandler struct has no free() function pointer because the user remains 02046 * responsible for freeing the resources associated with this struct. 02047 */ 02048 struct XQC_ErrorHandler_s { 02049 02050 /** 02051 * The function is called when an error occurs. The function receives the components of the 02052 * error as arguments. When this function returns, the implementation will exit query parsing or 02053 * execution with the error enumeration value passed as an argument. 02054 * 02055 * \param handler The XQC_ErrorHandler that this function pointer is a member of 02056 * \param error The error as a value of the XQUERY_ERROR enum. 02057 * \param local_name The local name of the error or an empty string if no local_name is given 02058 * (e.g. for errors not defined in the spec). 02059 * \param description A detailed description of the error or an empty string if no description is available. 02060 * \param query_uri The uri of the query causing the error or an empty string if no uri is available for the query. 02061 * \param line The line number of the query where the error occured. 02062 * \param components The column number in the line in the query where the error occured. 02063 */ 02064 void (*error)(XQC_ErrorHandler handler, 02065 XQUERY_ERROR error, 02066 const char *local_name, 02067 const char *description, 02068 const char *query_uri, 02069 unsigned int line, 02070 unsigned int column); 02071 02072 /** 02073 * Can be used for user specific purposes. 02074 */ 02075 void *user_data; 02076 02077 }; 02078 02079 02080 /** 02081 * \example csimple.c 02082 * This is a simple example that demonstrate how to use the Zorba XQuery Engine to 02083 * create, compile, and execute queries. 02084 * 02085 * \example cdatamanager.c 02086 * This file contains some examples that demonstrate how the data manger can be used 02087 * to load files, create collection, etc. 02088 * 02089 * \example ccontext.c 02090 * This file demonstrates how the item factory can be used to create new items and 02091 * bind the items to external variables in the dynamic context before executing a query. 02092 * 02093 * \example cerror.c 02094 * This file demonstrates how to use the error callback function when a static, runtime, type, or serialization 02095 * error occurs during parsing or executing the query. 02096 * 02097 * \example cexternal_functions.c 02098 * This file demonstrates how to write an external function. 02099 * 02100 * \example cserialization.c 02101 * This file shows how to use serialize the result of a query. It includes examples that 02102 * demonstrate how to change serialization parameters or use the XQC_OutputStream to 02103 * retrieve the query result as a stream. 02104 */ 02105 02106 #ifdef __cplusplus 02107 } 02108 #endif 02109 02110 #endif