With-defaults tagged: move wd attribute from <data> to level under

show cli: remove empty container
This commit is contained in:
Olof hagsand 2022-09-09 13:00:01 +02:00
parent 743076b171
commit 51fca05642
2 changed files with 8 additions and 2 deletions

View file

@ -484,6 +484,7 @@ with_defaults(cxobj *xe,
int retval = -1; int retval = -1;
cxobj *xfind; cxobj *xfind;
char *mode; char *mode;
cxobj *x;
if ((xfind = xml_find(xe, "with-defaults")) != NULL) { if ((xfind = xml_find(xe, "with-defaults")) != NULL) {
if ((mode = xml_find_value(xfind, "body")) == NULL) if ((mode = xml_find_value(xfind, "body")) == NULL)
@ -520,7 +521,9 @@ with_defaults(cxobj *xe,
goto ok; goto ok;
} }
else if (strcmp(mode, "report-all-tagged") == 0) { else if (strcmp(mode, "report-all-tagged") == 0) {
if (xmlns_set(xret, IETF_NETCONF_WITH_DEFAULTS_ATTR_PREFIX, IETF_NETCONF_WITH_DEFAULTS_ATTR_NAMESPACE) < 0) x = NULL;
while ((x = xml_child_each(xret, x, CX_ELMNT)) != NULL)
if (xmlns_set(x, IETF_NETCONF_WITH_DEFAULTS_ATTR_PREFIX, IETF_NETCONF_WITH_DEFAULTS_ATTR_NAMESPACE) < 0)
goto done; goto done;
/* Mark nodes having default schema values */ /* Mark nodes having default schema values */
if (xml_apply(xret, CX_ELMNT, (xml_applyfn_t*) xml_flag_default_value, (void*) XML_FLAG_MARK) < 0) if (xml_apply(xret, CX_ELMNT, (xml_applyfn_t*) xml_flag_default_value, (void*) XML_FLAG_MARK) < 0)

View file

@ -477,6 +477,9 @@ cli_auto_show(clicon_handle h,
strcmp(defaultstr, "report-all-tagged-strip") strcmp(defaultstr, "report-all-tagged-strip")
) < 0) ) < 0)
goto done; goto done;
/* Remove empty containers */
if (xml_defaults_nopresence(xt, 2) < 0)
goto done;
} }
if (xpath_vec(xt, nsc, "%s", &vec, &veclen, xpath) < 0) if (xpath_vec(xt, nsc, "%s", &vec, &veclen, xpath) < 0)
goto done; goto done;