* C-API change: xml_new() changed from xml_new(name, xp, ys) to xml_new(name, prefix, xp, type)

* If you have used, `ys`, add `xml_spec_set(x, ys)` after the statement
  * If you have `xml_type_set(x, TYPE)` or `xml_prefix_set(x, PREFIX)` immediately after the statement, you can remove those and set them directly as: `xml_new(name, PREFIX, xp, TYPE)`
This commit is contained in:
Olof hagsand 2020-03-12 22:29:28 +01:00
parent 71efe18f94
commit 7425a3b520
26 changed files with 135 additions and 155 deletions

View file

@ -327,7 +327,7 @@ api_data_write(clicon_handle h,
xret = NULL;
}
/* Create config top-of-tree */
if ((xtop = xml_new("config", NULL, NULL)) == NULL)
if ((xtop = xml_new("config", NULL, NULL, CX_ELMNT)) == NULL)
goto done;
/* Translate api_path to xml in the form of xtop/xbot */
xbot = xtop;
@ -362,7 +362,7 @@ api_data_write(clicon_handle h,
}
/* Create a dummy data tree parent to hook in the parsed data.
*/
if ((xdata0 = xml_new("data0", NULL, NULL)) == NULL)
if ((xdata0 = xml_new("data0", NULL, NULL, CX_ELMNT)) == NULL)
goto done;
if (api_path){ /* XXX mv to copy? */
cxobj *xfrom;
@ -373,7 +373,7 @@ api_data_write(clicon_handle h,
goto done;
xa = NULL;
while ((xa = xml_child_each(xfrom, xa, CX_ATTR)) != NULL) {
if ((xac = xml_new(xml_name(xa), xdata0, NULL)) == NULL)
if ((xac = xml_new(xml_name(xa), NULL, xdata0, CX_ATTR)) == NULL)
goto done;
if (xml_copy(xa, xac) < 0) /* recursion */
goto done;
@ -479,11 +479,8 @@ api_data_write(clicon_handle h,
/* Add operation create as attribute. If that fails with Conflict, then
* try "replace" (see comment in function header)
*/
if ((xa = xml_new("operation", xdata, NULL)) == NULL)
if ((xa = xml_new("operation", NETCONF_BASE_PREFIX, xdata, CX_ATTR)) == NULL)
goto done;
xml_type_set(xa, CX_ATTR);
xml_prefix_set(xa, NETCONF_BASE_PREFIX);
if (xml_value_set(xa, xml_operation2str(op)) < 0)
goto done;
@ -839,7 +836,7 @@ api_data_delete(clicon_handle h,
for (i=0; i<pi; i++)
api_path = index(api_path+1, '/');
/* Create config top-of-tree */
if ((xtop = xml_new("config", NULL, NULL)) == NULL)
if ((xtop = xml_new("config", NULL, NULL, CX_ELMNT)) == NULL)
goto done;
xbot = xtop;
if (api_path){
@ -855,9 +852,8 @@ api_data_delete(clicon_handle h,
goto ok;
}
}
if ((xa = xml_new("operation", xbot, NULL)) == NULL)
if ((xa = xml_new("operation", NULL, xbot, CX_ATTR)) == NULL)
goto done;
xml_type_set(xa, CX_ATTR);
if (xml_value_set(xa, xml_operation2str(op)) < 0)
goto done;
if (xml_namespace_change(xa, NETCONF_BASE_NAMESPACE, NETCONF_BASE_PREFIX) < 0)