Loading...
Searching...
No Matches
xpath.h
Go to the documentation of this file.
#ifndef SYSREPO_XPATH_H_
#define SYSREPO_XPATH_H_
#include "../sysrepo.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct sr_xpath_ctx_s {
char *begining;
char *current_node;
char *replaced_position;
char replaced_char;
} sr_xpath_ctx_t;
char *sr_xpath_next_node(char *xpath, sr_xpath_ctx_t *state);
char *sr_xpath_last_node(char *xpath, sr_xpath_ctx_t *state);
char *sr_xpath_next_node_with_ns(char *xpath, sr_xpath_ctx_t *state);
char *sr_xpath_next_key_name(char *xpath, sr_xpath_ctx_t *state);
char *sr_xpath_next_key_value(char *xpath, sr_xpath_ctx_t *state);
char *sr_xpath_node(char *xpath, const char *node_name, sr_xpath_ctx_t *state);
char *sr_xpath_node_rel(char *xpath, const char *node_name, sr_xpath_ctx_t *state);
char *sr_xpath_node_idx(char *xpath, size_t index, sr_xpath_ctx_t *state);
char *sr_xpath_node_idx_rel(char *xpath, size_t index, sr_xpath_ctx_t *state);
char *sr_xpath_node_key_value(char *xpath, const char *key, sr_xpath_ctx_t *state);
char *sr_xpath_node_key_value_idx(char *xpath, size_t index, sr_xpath_ctx_t *state);
char *sr_xpath_key_value(char *xpath, const char *node_name, const char *key_name, sr_xpath_ctx_t *state);
char *sr_xpath_key_value_idx(char *xpath, size_t node_index, size_t key_index, sr_xpath_ctx_t *state);
char *sr_xpath_node_name(const char *xpath);
int sr_xpath_node_name_eq(const char *xpath, const char *node_str);
void sr_xpath_recover(sr_xpath_ctx_t *state);
#ifdef __cplusplus
}
#endif
#endif /* SYSREPO_XPATH_H_ */
sr_xpath_ctx_s::begining
char * begining
Definition xpath.h:46
sr_xpath_ctx_s::current_node
char * current_node
Definition xpath.h:47
sr_xpath_ctx_s::replaced_position
char * replaced_position
Definition xpath.h:48
sr_xpath_ctx_s::replaced_char
char replaced_char
Definition xpath.h:49
sr_xpath_ctx_s
State of xpath parsing. User must not modify nor rely on the content of the structure.
Definition xpath.h:45
sr_xpath_node_idx
char * sr_xpath_node_idx(char *xpath, size_t index, sr_xpath_ctx_t *state)
Returns node specified by index starting at the begin of expression. First node has index 0.
sr_xpath_ctx_t
struct sr_xpath_ctx_s sr_xpath_ctx_t
State of xpath parsing. User must not modify nor rely on the content of the structure.
sr_xpath_node_name
char * sr_xpath_node_name(const char *xpath)
Returns pointer to the string after the last slash in xpath (node name).
sr_xpath_node_rel
char * sr_xpath_node_rel(char *xpath, const char *node_name, sr_xpath_ctx_t *state)
Similar to sr_xpath_node. The difference is that search start at current node according to the state.
sr_xpath_last_node
char * sr_xpath_last_node(char *xpath, sr_xpath_ctx_t *state)
Returns pointer to the last node.
sr_xpath_key_value
char * sr_xpath_key_value(char *xpath, const char *node_name, const char *key_name, sr_xpath_ctx_t *state)
Looks up the value of the key in a node specified by name.
sr_xpath_recover
void sr_xpath_recover(sr_xpath_ctx_t *state)
Recovers the xpath string to the original state (puts back the character that was replaced by termina...
sr_xpath_node_idx_rel
char * sr_xpath_node_idx_rel(char *xpath, size_t index, sr_xpath_ctx_t *state)
Return node specified by index. Following node has index zero.
sr_xpath_next_key_name
char * sr_xpath_next_key_name(char *xpath, sr_xpath_ctx_t *state)
Returns the name of the next key at the current level in processed xpath.
sr_xpath_node_key_value
char * sr_xpath_node_key_value(char *xpath, const char *key, sr_xpath_ctx_t *state)
Looks up the value for the key at the current level in xpath.
sr_xpath_node_name_eq
int sr_xpath_node_name_eq(const char *xpath, const char *node_str)
Compares string after the last slash in xpath (node name) with provided string.
sr_xpath_next_key_value
char * sr_xpath_next_key_value(char *xpath, sr_xpath_ctx_t *state)
Returns the value of the next key at the current level in processed xpath.
sr_xpath_next_node
char * sr_xpath_next_node(char *xpath, sr_xpath_ctx_t *state)
The function returns a pointer to the following node. If xpath is not NULL returns the first node nam...
sr_xpath_node
char * sr_xpath_node(char *xpath, const char *node_name, sr_xpath_ctx_t *state)
Returns a pointer to the node specified by name. It searches from the beginning of the xpath,...
sr_xpath_node_key_value_idx
char * sr_xpath_node_key_value_idx(char *xpath, size_t index, sr_xpath_ctx_t *state)
Looks up the value for the key at the current level in xpath specified by index. First key has index ...
sr_xpath_next_node_with_ns
char * sr_xpath_next_node_with_ns(char *xpath, sr_xpath_ctx_t *state)
Same as sr_xpath_next_node with the difference that namespace is included in result if present in xpa...
sr_xpath_key_value_idx
char * sr_xpath_key_value_idx(char *xpath, size_t node_index, size_t key_index, sr_xpath_ctx_t *state)
Looks up the value of the key in a node specified by index. First node has index zero.
sysrepo.h
public API sysrepo header