Changed C-API for xml translation/print the internal cxobj tree data structure to other formats

New API is as follows:
  * `clixon_xml2file()` - Print internal tree as XML to file
  * `clixon_xml2cbuf()` - Print internal tree as XML to buffer
  * `clixon_json2file()` - Print internal tree as JSON to file
  * `clixon_json2cbuf()` - Print internal tree as JSON to buffer
  * `clixon_cli2file()` - Print internal tree as CLI format to file
  * `clixon_txt2file()` - Print internal tree as text format to file
This commit is contained in:
Olof hagsand 2022-06-01 20:02:27 +02:00
parent 87719c623c
commit 0c79298e76
49 changed files with 421 additions and 503 deletions

View file

@ -365,7 +365,7 @@ get_nacm_and_reply(clicon_handle h,
if (xml_name_set(xret, NETCONF_OUTPUT_DATA) < 0)
goto done;
/* Top level is data, so add 1 to depth if significant */
if (clicon_xml2cbuf(cbret, xret, 0, 0, depth>0?depth+1:depth, 0) < 0)
if (clixon_xml2cbuf(cbret, xret, 0, 0, depth>0?depth+1:depth, 0) < 0)
goto done;
}
cprintf(cbret, "</rpc-reply>");
@ -605,7 +605,7 @@ get_list_pagination(clicon_handle h,
clicon_err_reason);
if (netconf_operation_failed_xml(&xerr, "application", cbuf_get(cberr)) < 0)
goto done;
if (clicon_xml2cbuf(cbret, xerr, 0, 0, -1, 0) < 0)
if (clixon_xml2cbuf(cbret, xerr, 0, 0, -1, 0) < 0)
goto done;
goto ok;
}
@ -620,7 +620,7 @@ get_list_pagination(clicon_handle h,
". Internal error, state callback returned invalid XML",
NULL) < 0)
goto done;
if (clicon_xml2cbuf(cbret, xerr, 0, 0, -1, 0) < 0)
if (clixon_xml2cbuf(cbret, xerr, 0, 0, -1, 0) < 0)
goto done;
goto ok;
}
@ -832,7 +832,7 @@ get_common(clicon_handle h,
if ((ret = get_client_statedata(h, xpath?xpath:"/", nsc, &xret)) < 0)
goto done;
if (ret == 0){ /* Error from callback (error in xret) */
if (clicon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
goto done;
goto ok;
}
@ -857,7 +857,7 @@ get_common(clicon_handle h,
". Internal error, state callback returned invalid XML",
NULL) < 0)
goto done;
if (clicon_xml2cbuf(cbret, xerr, 0, 0, -1, 0) < 0)
if (clixon_xml2cbuf(cbret, xerr, 0, 0, -1, 0) < 0)
goto done;
goto ok;
}