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