Hi,
Oh, it's also the documentation that made me thought it should use data path here. In fact, I got this issue from sysrepo, which also used lys_xpath_atomize
with data path in JSON format. Have you already notified sysrepo guys about this change?
lys_xpath_atomize works unexpectedly
Hi,
it seems lys_xpath_atomize
can not work in latest devel branch, below is my test code:
c
int main(void)
{
struct ly_ctx *ly_ctx = ly_ctx_new(NULL, 0);
const struct lys_module *module = lys_parse_path(ly_ctx, "a.yang", LYS_IN_YANG);
printf("load a %s\n", module ? "success" : "failure");
const struct lys_module *module2 = lys_parse_path(ly_ctx, "b.yang", LYS_IN_YANG);
printf("load b %s\n", module2 ? "success" : "failure");
struct ly_set *set = lys_xpath_atomize(module->data, LYXP_NODE_ELEM,
"/a:A/A1/b:B[k1=1]/C[k2=1]", 0);
assert(set);
assert(set->number);
printf("count: %d, last: %s\n", set->number, set->set.s[set->number - 1]->name);
ly_set_free(set);
ly_ctx_destroy(ly_ctx, NULL);
return 0;
}
the output is
load a success
load b success
exe: /root/svn/nfoam/libyang/src/xpath.c:6847: eval_predicate: Assertion `exp->tokens[*exp_idx] == LYXP_TOKEN_BRACK2' failed.
Aborted
该提问来源于开源项目:CESNET/libyang
- 点赞
- 写回答
- 关注问题
- 收藏
- 复制链接分享
- 邀请回答