- Main Page
- Modules
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

# axiom_xpath.h

    00001
    00002 /*
    00003  * Licensed to the Apache Software Foundation (ASF) under one or more
    00004  * contributor license agreements.  See the NOTICE file distributed with
    00005  * this work for additional information regarding copyright ownership.
    00006  * The ASF licenses this file to You under the Apache License, Version 2.0
    00007  * (the "License"); you may not use this file except in compliance with
    00008  * the License.  You may obtain a copy of the License at
    00009  *
    00010  *      http://www.apache.org/licenses/LICENSE-2.0
    00011  *
    00012  * Unless required by applicable law or agreed to in writing, software
    00013  * distributed under the License is distributed on an "AS IS" BASIS,
    00014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00015  * See the License for the specific language governing permissions and
    00016  * limitations under the License.
    00017  */
    00018
    00019 #ifndef AXIOM_XPATH_H
    00020 #define AXIOM_XPATH_H
    00021
    00022 #include <axiom.h>
    00023 #include <axutil_env.h>
    00024 #include <axutil_stack.h>
    00025 #include <axiom_soap.h>
    00026
    00027 #ifdef __cplusplus
    00028 extern "C"
    00029 {
    00030 #endif
    00031
    00043 #define AXIOM_XPATH_DEBUG
    00044
    00048 #define AXIOM_XPATH_EVALUATION_ERROR 0
    00049
    00050 #define AXIOM_XPATH_ERROR_STREAMING_NOT_SUPPORTED 10
    00051
    00052     /* Typedefs */
    00053
    00058     typedef struct axiom_xpath_expression axiom_xpath_expression_t;
    00059
    00065     typedef struct axiom_xpath_context axiom_xpath_context_t;
    00066
    00072     typedef struct axiom_xpath_result axiom_xpath_result_t;
    00073
    00078     typedef struct axiom_xpath_result_node axiom_xpath_result_node_t;
    00079
    00083     typedef enum axiom_xpath_result_type_t
    00084     {
    00085         AXIOM_XPATH_TYPE_NODE = 0,
    00086         AXIOM_XPATH_TYPE_ATTRIBUTE,
    00087         AXIOM_XPATH_TYPE_NAMESPACE,
    00088         AXIOM_XPATH_TYPE_TEXT,
    00089         AXIOM_XPATH_TYPE_NUMBER,
    00090         AXIOM_XPATH_TYPE_BOOLEAN
    00091     } axiom_xpath_result_type_t;
    00092
    00093     typedef int (*axiom_xpath_function_t)(axiom_xpath_context_t *context,
    00094             int np);
    00095
    00099     struct axiom_xpath_expression
    00100     {
    00102         axis2_char_t* expr_str;
    00103
    00105         int expr_len;
    00106
    00108         int expr_ptr;
    00109
    00111         axutil_array_list_t *operations;
    00112
    00114         int start;
    00115     };
    00116
    00120     struct axiom_xpath_context
    00121     {
    00123         const axutil_env_t *env;
    00124
    00126         axutil_hash_t *namespaces;
    00127
    00129         axutil_hash_t *functions;
    00130
    00132         axiom_node_t *root_node;
    00133
    00135         axiom_node_t *node;
    00136
    00138         axiom_attribute_t *attribute;
    00139
    00141         axiom_namespace_t *ns;
    00142
    00144         int position;
    00145
    00148         int size;
    00149
    00151         axiom_xpath_expression_t *expr;
    00152
    00154         axis2_bool_t streaming;
    00155
    00157         axutil_stack_t *stack;
    00158
    00159         /* TODO:
    00160            functions
    00161            variables
    00162            etc */
    00163     };
    00164
    00168     struct axiom_xpath_result
    00169     {
    00172         int flag;
    00173
    00175         axutil_array_list_t * nodes;
    00176     };
    00177
    00181     struct axiom_xpath_result_node
    00182     {
    00184         axiom_xpath_result_type_t type;
    00185
    00187         void * value;
    00188     };
    00189
    00198     AXIS2_EXTERN axiom_xpath_expression_t * AXIS2_CALL axiom_xpath_compile_expression(
    00199         const axutil_env_t *env,
    00200         const axis2_char_t* xpath_expr);
    00201
    00209     AXIS2_EXTERN axiom_xpath_context_t * AXIS2_CALL axiom_xpath_context_create(
    00210         const axutil_env_t *env,
    00211         axiom_node_t * root_node);
    00212
    00222     AXIS2_EXTERN axiom_xpath_result_t * AXIS2_CALL axiom_xpath_evaluate(
    00223         axiom_xpath_context_t *context,
    00224         axiom_xpath_expression_t *xpath_expr);
    00225
    00226
    00238     AXIS2_EXTERN axis2_bool_t AXIS2_CALL axiom_xpath_cast_node_to_boolean(
    00239         const axutil_env_t *env,
    00240         axiom_xpath_result_node_t * node);
    00241
    00252     AXIS2_EXTERN double AXIS2_CALL axiom_xpath_cast_node_to_number(
    00253         const axutil_env_t *env,
    00254         axiom_xpath_result_node_t * node);
    00255
    00268     AXIS2_EXTERN axis2_char_t * AXIS2_CALL axiom_xpath_cast_node_to_string(
    00269         const axutil_env_t *env,
    00270         axiom_xpath_result_node_t * node);
    00271
    00280     AXIS2_EXTERN axiom_node_t * AXIS2_CALL axiom_xpath_cast_node_to_axiom_node(
    00281         const axutil_env_t *env,
    00282         axiom_xpath_result_node_t * node);
    00283
    00284
    00291     AXIS2_EXTERN void AXIS2_CALL axiom_xpath_free_context(
    00292         const axutil_env_t *env,
    00293         axiom_xpath_context_t *context);
    00294
    00301     AXIS2_EXTERN void AXIS2_CALL axiom_xpath_free_expression(
    00302         const axutil_env_t *env,
    00303         axiom_xpath_expression_t * xpath_expr);
    00304
    00311     AXIS2_EXTERN void AXIS2_CALL axiom_xpath_free_result(
    00312         const axutil_env_t *env,
    00313         axiom_xpath_result_t* result);
    00314
    00321     AXIS2_EXTERN void AXIS2_CALL axiom_xpath_register_namespace(
    00322         axiom_xpath_context_t *context,
    00323         axiom_namespace_t *ns);
    00324
    00333     AXIS2_EXTERN axiom_namespace_t * AXIS2_CALL axiom_xpath_get_namespace(
    00334         axiom_xpath_context_t *context,
    00335         axis2_char_t *prefix);
    00336
    00342     AXIS2_EXTERN void AXIS2_CALL axiom_xpath_clear_namespaces(
    00343         axiom_xpath_context_t *context);
    00344
    00353     AXIS2_EXTERN axiom_xpath_result_t * AXIS2_CALL axiom_xpath_evaluate_streaming(
    00354         axiom_xpath_context_t *context,
    00355         axiom_xpath_expression_t *xpath_expr);
    00356
    00365     AXIS2_EXTERN axis2_bool_t AXIS2_CALL axiom_xpath_streaming_check(
    00366         const axutil_env_t *env,
    00367         axiom_xpath_expression_t* expr);
    00368
    00374     AXIS2_EXTERN void AXIS2_CALL axiom_xpath_register_default_functions_set(
    00375         axiom_xpath_context_t *context);
    00376
    00384     AXIS2_EXTERN void AXIS2_CALL axiom_xpath_register_function(
    00385         axiom_xpath_context_t *context,
    00386         axis2_char_t *name,
    00387         axiom_xpath_function_t func);
    00388
    00397     AXIS2_EXTERN axiom_xpath_function_t AXIS2_CALL axiom_xpath_get_function(
    00398         axiom_xpath_context_t *context,
    00399         axis2_char_t *name);
    00400
    00403 #ifdef __cplusplus
    00404 }
    00405 #endif
    00406
    00407 #endif