* Added namespace-context parameter nsc to xpath_first and xpath_vec, (xpath_vec_nsc and xpath_first_nsc` are removed).

This commit is contained in:
Olof hagsand 2019-12-07 20:46:13 +01:00
parent ba2f40728b
commit d68a829862
32 changed files with 186 additions and 318 deletions

View file

@ -707,13 +707,13 @@ compare_dbs(clicon_handle h,
astext = 0;
if (clicon_rpc_get_config(h, NULL, "running", "/", NULL, &xc1) < 0)
goto done;
if ((xerr = xpath_first(xc1, "/rpc-error")) != NULL){
if ((xerr = xpath_first(xc1, NULL, "/rpc-error")) != NULL){
clicon_rpc_generate_error("Get configuration", xerr);
goto done;
}
if (clicon_rpc_get_config(h, NULL, "candidate", "/", NULL, &xc2) < 0)
goto done;
if ((xerr = xpath_first(xc2, "/rpc-error")) != NULL){
if ((xerr = xpath_first(xc2, NULL, "/rpc-error")) != NULL){
clicon_rpc_generate_error("Get configuration", xerr);
goto done;
}
@ -877,7 +877,7 @@ save_config_file(clicon_handle h,
clicon_err(OE_CFG, 0, "get config: empty tree"); /* Shouldnt happen */
goto done;
}
if ((xerr = xpath_first(xt, "/rpc-error")) != NULL){
if ((xerr = xpath_first(xt, NULL, "/rpc-error")) != NULL){
clicon_rpc_generate_error("Get configuration", xerr);
goto done;
}
@ -985,7 +985,7 @@ cli_notification_cb(int s,
}
if (clicon_msg_decode(reply, NULL, NULL, &xt) < 0) /* XXX pass yang_spec */
goto done;
if ((xe = xpath_first(xt, "//event")) != NULL){
if ((xe = xpath_first(xt, NULL, "//event")) != NULL){
x = NULL;
while ((x = xml_child_each(xe, x, -1)) != NULL) {
switch (format){
@ -1217,7 +1217,7 @@ cli_copy_config(clicon_handle h,
/* Get from object configuration and store in x1 */
if (clicon_rpc_get_config(h, NULL, db, cbuf_get(cb), nsc, &x1) < 0)
goto done;
if ((xerr = xpath_first(x1, "/rpc-error")) != NULL){
if ((xerr = xpath_first(x1, NULL, "/rpc-error")) != NULL){
clicon_rpc_generate_error("Get configuration", xerr);
goto done;
}
@ -1236,7 +1236,7 @@ cli_copy_config(clicon_handle h,
xml_name_set(x2, "config");
cprintf(cb, "/%s", keyname);
if ((x = xpath_first_nsc(x2, nsc, "%s", cbuf_get(cb))) == NULL){
if ((x = xpath_first(x2, nsc, "%s", cbuf_get(cb))) == NULL){
clicon_err(OE_PLUGIN, 0, "Field %s not found in copy tree", keyname);
goto done;
}