<libroxml
version="3.0.2"
/>
|
xpath execution module More...
#include <stdlib.h>
#include <string.h>
#include "roxml_mem.h"
#include "roxml_core.h"
#include "roxml_xpath.h"
#include "roxml_parser.h"
Go to the source code of this file.
Functions | |
ROXML_STATIC ROXML_INT int | roxml_is_number (char *input) |
number tester | |
ROXML_STATIC ROXML_INT void | roxml_free_xcond (xpath_cond_t *xcond) |
xpath condition free function | |
ROXML_INT void | roxml_free_xpath (xpath_node_t *xpath, int nb) |
xpath free function | |
ROXML_STATIC ROXML_INT int | roxml_in_pool (node_t *root, node_t *n, int req_id) |
node pool presence tester function | |
ROXML_STATIC ROXML_INT void | roxml_del_from_pool (node_t *root, node_t *n, int req_id) |
pool node delete function | |
ROXML_STATIC ROXML_INT int | roxml_add_to_pool (node_t *root, node_t *n, int req_id) |
add a token top node function | |
ROXML_STATIC ROXML_INT void | roxml_release_id (node_t *root, node_t **pool, int pool_len, int req_id) |
release id function | |
ROXML_STATIC ROXML_INT int | roxml_request_id (node_t *root) |
id reservation function | |
ROXML_STATIC ROXML_INT void | roxml_compute_and (node_t *root, node_t **node_set, int *count, int cur_req_id, int prev_req_id) |
node set and function | |
ROXML_STATIC ROXML_INT void | roxml_compute_or (node_t *root, node_t **node_set, int *count, int req_id, int glob_id) |
node set or function | |
ROXML_STATIC ROXML_INT int | roxml_parse_xpath (char *path, xpath_node_t **xpath, int context) |
xpath parsing function | |
ROXML_STATIC ROXML_INT int | roxml_get_node_internal_position (node_t *n) |
node absolute position get | |
ROXML_STATIC ROXML_INT double | roxml_double_oper (double a, double b, int op) |
double operation function | |
ROXML_STATIC ROXML_INT int | roxml_double_cmp (double a, double b, int op) |
double comparison function | |
ROXML_STATIC ROXML_INT int | roxml_string_cmp (char *sa, char *sb, int op) |
string comparison function | |
ROXML_STATIC ROXML_INT int | roxml_validate_predicat (xpath_node_t *xn, xpath_cond_t *condition, node_t *candidat) |
predicat validation function | |
ROXML_STATIC ROXML_INT void | roxml_add_to_set (node_t *root, node_t *candidat, node_t ***ans, int *nb, int *max, int req_id) |
ROXML_STATIC ROXML_INT int | roxml_validate_axe_func (node_t *root, node_t **candidat, xpath_node_t *xn) |
ROXML_STATIC ROXML_INT int | roxml_validate_axe_name (node_t *candidat, xpath_node_t *xn) |
ROXML_STATIC ROXML_INT int | roxml_validate_axes (node_t *root, node_t *candidat, node_t ***ans, int *nb, int *max, xpath_node_t *xn, int req_id) |
axe validation function | |
ROXML_STATIC ROXML_INT void | roxml_check_node (xpath_node_t *xp, node_t *root, node_t *context, node_t ***ans, int *nb, int *max, int ignore, int req_id) |
real xpath validation function | |
ROXML_INT node_t ** | roxml_exec_xpath (node_t *root, node_t *n, xpath_node_t *xpath, int index, int *count) |
real xpath execution | |
ROXML_API node_t ** | roxml_xpath (node_t *n, char *path, int *nb_ans) |
exec path function | |
ROXML_STATIC ROXML_INT xpath_node_t * | roxml_set_axes (xpath_node_t *node, char *axes, int *offset) |
axes setter function | |
ROXML_INT int | _func_xpath_ignore (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_new_node (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_quote (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_dquote (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_open_parenthesys (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_close_parenthesys (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_open_brackets (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_close_brackets (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_condition_or (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_condition_and (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_path_or (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_operators (roxml_parser_item_t *parser, char *chunk, void *data, int operator, int operator_bis) |
ROXML_INT int | _func_xpath_operator_equal (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_operator_sup (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_operator_inf (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_operator_diff (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_number (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_funcs (roxml_parser_item_t *parser, char *chunk, void *data, int func, char *name) |
ROXML_INT int | _func_xpath_position (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_first (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_last (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_nsuri (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_lname (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_operator_add (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_operator_subs (roxml_parser_item_t *parser, char *chunk, void *data) |
ROXML_INT int | _func_xpath_default (roxml_parser_item_t *parser, char *chunk, void *data) |
xpath execution module
(C) Copyright 2014 Tristan Lelong trist.nosp@m.an.l.nosp@m.elong.nosp@m.@lib.nosp@m.roxml.nosp@m..net
SPDX-Licence-Identifier: LGPL-2.1+ The author added a static linking exception, see License.txt.
Definition in file roxml_xpath.c.
ROXML_INT int _func_xpath_close_brackets | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1217 of file roxml_xpath.c.
ROXML_INT int _func_xpath_close_parenthesys | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1181 of file roxml_xpath.c.
ROXML_INT int _func_xpath_condition_and | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1292 of file roxml_xpath.c.
ROXML_INT int _func_xpath_condition_or | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1243 of file roxml_xpath.c.
ROXML_INT int _func_xpath_default | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1584 of file roxml_xpath.c.
ROXML_INT int _func_xpath_dquote | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1152 of file roxml_xpath.c.
ROXML_INT int _func_xpath_first | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1510 of file roxml_xpath.c.
ROXML_INT int _func_xpath_funcs | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data, | ||
int | func, | ||
char * | name | ||
) |
Definition at line 1483 of file roxml_xpath.c.
ROXML_INT int _func_xpath_ignore | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1094 of file roxml_xpath.c.
ROXML_INT int _func_xpath_last | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1518 of file roxml_xpath.c.
ROXML_INT int _func_xpath_lname | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1534 of file roxml_xpath.c.
ROXML_INT int _func_xpath_new_node | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1102 of file roxml_xpath.c.
ROXML_INT int _func_xpath_nsuri | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1526 of file roxml_xpath.c.
ROXML_INT int _func_xpath_number | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1462 of file roxml_xpath.c.
ROXML_INT int _func_xpath_open_brackets | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1193 of file roxml_xpath.c.
ROXML_INT int _func_xpath_open_parenthesys | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1169 of file roxml_xpath.c.
ROXML_INT int _func_xpath_operator_add | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1542 of file roxml_xpath.c.
ROXML_INT int _func_xpath_operator_diff | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1454 of file roxml_xpath.c.
ROXML_INT int _func_xpath_operator_equal | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1430 of file roxml_xpath.c.
ROXML_INT int _func_xpath_operator_inf | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1446 of file roxml_xpath.c.
ROXML_INT int _func_xpath_operator_subs | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1563 of file roxml_xpath.c.
ROXML_INT int _func_xpath_operator_sup | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1438 of file roxml_xpath.c.
ROXML_INT int _func_xpath_operators | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data, | ||
int | operator, | ||
int | operator_bis | ||
) |
Definition at line 1365 of file roxml_xpath.c.
ROXML_INT int _func_xpath_path_or | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1340 of file roxml_xpath.c.
ROXML_INT int _func_xpath_position | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1502 of file roxml_xpath.c.
ROXML_INT int _func_xpath_quote | ( | roxml_parser_item_t * | parser, |
char * | chunk, | ||
void * | data | ||
) |
Definition at line 1135 of file roxml_xpath.c.
add a token top node function
this function add a token to target node. This token is used to garanty unicity in xpath results
root | the root node |
n | the node to mark |
req_id | the id to use |
Definition at line 152 of file roxml_xpath.c.
ROXML_STATIC ROXML_INT void roxml_add_to_set | ( | node_t * | root, |
node_t * | candidat, | ||
node_t *** | ans, | ||
int * | nb, | ||
int * | max, | ||
int | req_id | ||
) |
Definition at line 577 of file roxml_xpath.c.
roxml_check_node | ( | xpath_node_t * | xp, |
node_t * | root, | ||
node_t * | context, | ||
node_t *** | ans, | ||
int * | nb, | ||
int * | max, | ||
int | ignore, | ||
int | req_id | ||
) |
real xpath validation function
this function perform the xpath test on a tree
xp | the xpath nodes to test |
root | the root node |
context | the current context node |
ans | the pointer to answers pool |
nb | the number of answers in pool |
max | the current size of the pool |
ignore | a flag for some axes that are going thru all document |
req_id | the pool id |
Definition at line 720 of file roxml_xpath.c.
roxml_compute_and | ( | node_t * | root, |
node_t ** | node_set, | ||
int * | count, | ||
int | cur_req_id, | ||
int | prev_req_id | ||
) |
node set and function
this function computes the AND of two node pools. The resulting pool will have the same ID as cur_req_id.
root | the root of the tree |
node_set | the node set containing the 2 pools |
count | number of node in the node set |
cur_req_id | the id of the first group |
prev_req_id | the id of the second group |
Definition at line 242 of file roxml_xpath.c.
node set or function
this function computes the OR of two node pools. The resulting pool will have the same ID as glob_id.
root | the root of the tree |
node_set | the node set containing the 2 pools |
count | number of node in the node set |
req_id | the id of the first group |
glob_id | the id of the second group |
Definition at line 280 of file roxml_xpath.c.
pool node delete function
this function remove one node from a pool
root | the root of the tree |
n | the node to remove |
req_id | the pool id |
Definition at line 118 of file roxml_xpath.c.
roxml_double_cmp | ( | double | a, |
double | b, | ||
int | op | ||
) |
double comparison function
this function compare two doubles using one defined operator
a | first operand |
b | second operand |
op | the operator to use |
Definition at line 431 of file roxml_xpath.c.
roxml_double_oper | ( | double | a, |
double | b, | ||
int | op | ||
) |
double operation function
this function compare two doubles using one defined operator
a | first operand |
b | second operand |
op | the operator to use |
Definition at line 409 of file roxml_xpath.c.
roxml_exec_xpath | ( | node_t * | root, |
node_t * | n, | ||
xpath_node_t * | xpath, | ||
int | index, | ||
int * | count | ||
) |
real xpath execution
this function exec a decoded xpath strcuture
root | the root of the tree |
n | the context node |
xpath | the xpath structure |
index | the number of xpath condition in string |
count | the pointer to a variable that is filled with the resulting node number |
Definition at line 898 of file roxml_xpath.c.
roxml_free_xcond | ( | xpath_cond_t * | xcond | ) |
xpath condition free function
this function frees an xpath_cond_t cell
xcond | the xcond to free |
Definition at line 55 of file roxml_xpath.c.
roxml_free_xpath | ( | xpath_node_t * | xpath, |
int | nb | ||
) |
xpath free function
this function frees the parsed xpath structure
xpath | the xpath to free |
nb | the number of xpath structures in the table |
Definition at line 64 of file roxml_xpath.c.
roxml_get_node_internal_position | ( | node_t * | n | ) |
node absolute position get
this function returns the absolute position of the node between siblings
n | the node |
Definition at line 379 of file roxml_xpath.c.
node pool presence tester function
this function test is a node is in a pool
root | the root of the tree |
n | the node to test |
req_id | the pool id |
Definition at line 86 of file roxml_xpath.c.
int roxml_is_number | ( | char * | input | ) |
number tester
This function tells if a string is a number
input | string to test |
Definition at line 25 of file roxml_xpath.c.
roxml_parse_xpath | ( | char * | path, |
xpath_node_t ** | xpath, | ||
int | context | ||
) |
xpath parsing function
this function convert an xpath string to a table of list of xpath_node_t
path | the xpath string |
xpath | the parsed xpath |
context | 0 for a real xpath, 1 for a xpath in predicat |
Definition at line 300 of file roxml_xpath.c.
release id function
this function release a previously required id and remove all id token from the pool
root | the root of the tree that was used for id request |
pool | the result from xpath search using this id |
pool_len | the number of node in pool |
req_id | the id to release |
Definition at line 194 of file roxml_xpath.c.
roxml_request_id | ( | node_t * | root | ) |
id reservation function
this function request an available id for a new xpath search on the tree
root | the root of the tree where id table is stored |
Definition at line 214 of file roxml_xpath.c.
roxml_set_axes | ( | xpath_node_t * | node, |
char * | axes, | ||
int * | offset | ||
) |
axes setter function
this function set the axe to a xpath node from xpath string
node | the xpath node to fill |
axes | the string where axe is extracted from |
offset | the detected offset in axe string |
Definition at line 1015 of file roxml_xpath.c.
roxml_string_cmp | ( | char * | sa, |
char * | sb, | ||
int | op | ||
) |
string comparison function
this function compare two strings using one defined operator
sa | first operand |
sb | second operand |
op | the operator to use |
Definition at line 457 of file roxml_xpath.c.
ROXML_STATIC ROXML_INT int roxml_validate_axe_func | ( | node_t * | root, |
node_t ** | candidat, | ||
xpath_node_t * | xn | ||
) |
Definition at line 596 of file roxml_xpath.c.
ROXML_STATIC ROXML_INT int roxml_validate_axe_name | ( | node_t * | candidat, |
xpath_node_t * | xn | ||
) |
Definition at line 631 of file roxml_xpath.c.
roxml_validate_axes | ( | node_t * | root, |
node_t * | candidat, | ||
node_t *** | ans, | ||
int * | nb, | ||
int * | max, | ||
xpath_node_t * | xn, | ||
int | req_id | ||
) |
axe validation function
this function validate if an axe is matching the current node
root | the root node |
candidat | the node to test |
ans | the pointer to answers pool |
nb | the number of answers in pool |
max | the current size of the pool |
xn | the xpath node to test |
req_id | the pool id |
Definition at line 671 of file roxml_xpath.c.
roxml_validate_predicat | ( | xpath_node_t * | xn, |
xpath_cond_t * | condition, | ||
node_t * | candidat | ||
) |
predicat validation function
this function check for predicat validity. predicat is part between brackets
xn | the xpath node containing the predicat to test |
condition | the xpath condition to test |
candidat | the node to test |
Definition at line 492 of file roxml_xpath.c.
exec path function
This function return a node set (table of nodes) corresponding to a given xpath. resulting node set should be roxml_release when not used anymore (but not individual nodes)
n | is one node of the tree |
path | the xpath to use |
nb_ans | the number of results |
handled xpath are described in xpath handling
Definition at line 969 of file roxml_xpath.c.