* Much better support for XPATH 1.0 according to https://www.w3.org/TR/xpath-10 using yacc/lex
* NOTE: Due to an error in the previous implementation, all XPATH calls on the form `x[a=str]` where `str` is a string (not a number or XML symbol), must be changed to: `x[a='str'] or x[a="str"]`
* This includes all calls to `xpath_vec, xpath_first`, etc.
* All calls to cli_copy_config in CLI spec files must replace 2nd argument from `x[%s=%s]` to `x[%s='%s']`
* The old API is stillenabled. To define the new, define XPATH_USE_NEW in include/clixon_custom.h and recompile
This commit is contained in:
parent
5d7c4a8d18
commit
ba7f84afee
29 changed files with 395 additions and 79 deletions
|
|
@ -85,11 +85,30 @@ extern const map_str2int xpopmap[];
|
|||
*/
|
||||
#if defined(__GNUC__) && __GNUC__ >= 3
|
||||
int xpath_vec_nodeset(cxobj *xcur, char *format, cxobj ***vec, size_t *veclen, ...) __attribute__ ((format (printf, 2, 5)));
|
||||
int xpath_vec_nodeset_flag(cxobj *xcur, char *format, uint16_t flags,
|
||||
cxobj ***vec, size_t *veclen, ...) __attribute__ ((format (printf, 2, 6)));
|
||||
cxobj *xpath_first_nodeset(cxobj *xcur, char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
int xpath_vec_bool(cxobj *xcur, char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
|
||||
#else
|
||||
int xpath_vec_nodeset(cxobj *xcur, char *format, cxobj ***vec, size_t *veclen, ...);
|
||||
int xpath_vec_nodeset_flag(cxobj *xcur, char *format, uint16_t flags,
|
||||
cxobj ***vec, size_t *veclen, ...);
|
||||
cxobj *xpath_first_nodeset(cxobj *xcur, char *format, ...);
|
||||
int xpath_vec_bool(cxobj *xcur, char *format, ...);
|
||||
|
||||
#endif
|
||||
int xpath_vec_ctx(cxobj *xcur, char *xpath, xp_ctx **xrp);
|
||||
|
||||
/* backward compatible */
|
||||
#ifdef XPATH_USE_NEW
|
||||
#define xpath_first(cxtop, format, args...) xpath_first_nodeset(cxtop, format, ##args)
|
||||
#define xpath_vec(cxtop, format, vec, veclen, args...) xpath_vec_nodeset(cxtop, format, vec, veclen, ##args)
|
||||
#define xpath_vec_flag(cxtop, format, flags, vec, veclen, args...) xpath_vec_nodeset_flag(cxtop, format, flags, vec, veclen, ##args)
|
||||
#else
|
||||
#define xpath_first(cxtop, format, args...) xpath_first_xsl(cxtop, format, ##args)
|
||||
#define xpath_vec(cxtop, format, vec, veclen, args...) xpath_vec_xsl(cxtop, format, vec, veclen, ##args)
|
||||
#define xpath_vec_flag(cxtop, format, flags, vec, veclen, args...) xpath_vec_flag_xsl(cxtop, format, flags, vec, veclen, ##args)
|
||||
#endif
|
||||
|
||||
#endif /* _CLIXON_XPATH_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue