C-API: clixon_xml2file and clixon_xml2cbuf added prefix argument

Added in-mem xml diff function: `xml_tree_diff_print`
This commit is contained in:
Olof hagsand 2023-04-12 09:54:37 +02:00
parent 819a0b5a9e
commit 6335f810d3
43 changed files with 309 additions and 149 deletions

View file

@ -212,7 +212,7 @@ netconf_invalid_value(cbuf *cb,
if (netconf_invalid_value_xml(&xret, type, message) < 0)
goto done;
if (clixon_xml2cbuf(cb, xret, 0, 0, -1, 0) < 0)
if (clixon_xml2cbuf(cb, xret, 0, 0, NULL, -1, 0) < 0)
goto done;
retval = 0;
done:
@ -332,7 +332,7 @@ netconf_missing_attribute(cbuf *cb,
if (netconf_missing_attribute_xml(&xret, type, attr, message) < 0)
goto done;
if (clixon_xml2cbuf(cb, xret, 0, 0, -1, 0) < 0)
if (clixon_xml2cbuf(cb, xret, 0, 0, NULL, -1, 0) < 0)
goto done;
retval = 0;
done:
@ -361,7 +361,7 @@ netconf_bad_attribute(cbuf *cb,
if (netconf_bad_attribute_xml(&xret, type, info, message) < 0)
goto done;
if (clixon_xml2cbuf(cb, xret, 0, 0, -1, 0) < 0)
if (clixon_xml2cbuf(cb, xret, 0, 0, NULL, -1, 0) < 0)
goto done;
retval = 0;
done:
@ -538,7 +538,7 @@ netconf_missing_element(cbuf *cb,
if (netconf_common_xml(&xret, type, "missing-element",
"bad-element", element, message) < 0)
goto done;
if (clixon_xml2cbuf(cb, xret, 0, 0, -1, 0) < 0)
if (clixon_xml2cbuf(cb, xret, 0, 0, NULL, -1, 0) < 0)
goto done;
retval = 0;
done:
@ -584,7 +584,7 @@ netconf_bad_element(cbuf *cb,
if (netconf_common_xml(&xret, type, "bad-element",
"bad-element",element, message) < 0)
goto done;
if (clixon_xml2cbuf(cb, xret, 0, 0, -1, 0) < 0)
if (clixon_xml2cbuf(cb, xret, 0, 0, NULL, -1, 0) < 0)
goto done;
retval = 0;
done:
@ -622,7 +622,7 @@ netconf_unknown_element(cbuf *cb,
if (netconf_common_xml(&xret, type, "unknown-element",
"bad-element", element, message) < 0)
goto done;
if (clixon_xml2cbuf(cb, xret, 0, 0, -1, 0) < 0)
if (clixon_xml2cbuf(cb, xret, 0, 0, NULL, -1, 0) < 0)
goto done;
retval = 0;
done:
@ -669,7 +669,7 @@ netconf_unknown_namespace(cbuf *cb,
if (netconf_common_xml(&xret, type, "unknown-namespace",
"bad-namespace", ns, message) < 0)
goto done;
if (clixon_xml2cbuf(cb, xret, 0, 0, -1, 0) < 0)
if (clixon_xml2cbuf(cb, xret, 0, 0, NULL, -1, 0) < 0)
goto done;
retval = 0;
done:
@ -707,7 +707,7 @@ netconf_access_denied(cbuf *cb,
if (netconf_access_denied_xml(&xret, type, message) < 0)
goto done;
if (clixon_xml2cbuf(cb, xret, 0, 0, -1, 0) < 0)
if (clixon_xml2cbuf(cb, xret, 0, 0, NULL, -1, 0) < 0)
goto done;
retval = 0;
done:
@ -948,7 +948,7 @@ netconf_data_missing(cbuf *cb,
if (netconf_data_missing_xml(&xret, message) < 0)
goto done;
if (clixon_xml2cbuf(cb, xret, 0, 0, -1, 0) < 0)
if (clixon_xml2cbuf(cb, xret, 0, 0, NULL, -1, 0) < 0)
goto done;
retval = 0;
done:
@ -1153,7 +1153,7 @@ netconf_operation_not_supported(cbuf *cb,
if (netconf_operation_not_supported_xml(&xret, type, message) < 0)
goto done;
if (clixon_xml2cbuf(cb, xret, 0, 0, -1, 0) < 0)
if (clixon_xml2cbuf(cb, xret, 0, 0, NULL, -1, 0) < 0)
goto done;
retval = 0;
done:
@ -1181,7 +1181,7 @@ netconf_operation_failed(cbuf *cb,
if (netconf_operation_failed_xml(&xret, type, message) < 0)
goto done;
if (clixon_xml2cbuf(cb, xret, 0, 0, -1, 0) < 0)
if (clixon_xml2cbuf(cb, xret, 0, 0, NULL, -1, 0) < 0)
goto done;
retval = 0;
done:
@ -1266,7 +1266,7 @@ netconf_malformed_message(cbuf *cb,
if (netconf_malformed_message_xml(&xret, message) < 0)
goto done;
if (clixon_xml2cbuf(cb, xret, 0, 0, -1, 0) < 0)
if (clixon_xml2cbuf(cb, xret, 0, 0, NULL, -1, 0) < 0)
goto done;
retval = 0;
done:
@ -1351,7 +1351,7 @@ netconf_data_not_unique(cbuf *cb,
if (netconf_data_not_unique_xml(&xret, x, cvk) < 0)
goto done;
if (clixon_xml2cbuf(cb, xret, 0, 0, -1, 0) < 0)
if (clixon_xml2cbuf(cb, xret, 0, 0, NULL, -1, 0) < 0)
goto done;
retval = 0;
done:
@ -1704,7 +1704,7 @@ netconf_err2cb(cxobj *xerr,
cprintf(cberr, "%s ", xml_body(x));
if ((x=xpath_first(xerr, NULL, "//error-info")) != NULL &&
xml_child_nr(x) > 0){
if (clixon_xml2cbuf(cberr, xml_child_i(x, 0), 0, 0, -1, 0) < 0)
if (clixon_xml2cbuf(cberr, xml_child_i(x, 0), 0, 0, NULL, -1, 0) < 0)
goto done;
}
if ((x=xpath_first(xerr, NULL, "//error-app-tag"))!=NULL)
@ -2160,7 +2160,7 @@ netconf_output(int s,
{
cxobj *xt = NULL;
if (clixon_xml_parse_string(buf, YB_NONE, NULL, &xt, NULL) == 0){
if (clixon_xml2file(stderr, xml_child_i(xt, 0), 0, 0, fprintf, 0, 0) < 0)
if (clixon_xml2file(stderr, xml_child_i(xt, 0), 0, 0, NULL, fprintf, 0, 0) < 0)
goto done;
fprintf(stderr, "\n");
xml_free(xt);