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

@ -256,7 +256,8 @@ transaction_log(clicon_handle h,
}
for (i=0; i<td->td_dlen; i++){
xn = td->td_dvec[i];
clicon_xml2cbuf(cb, xn, 0, 0, -1, 0);
if (clixon_xml2cbuf(cb, xn, 0, 0, -1, 0) < 0)
goto done;
}
if (i)
clicon_log(level, "%s %" PRIu64 " %s del: %s",
@ -264,7 +265,8 @@ transaction_log(clicon_handle h,
cbuf_reset(cb);
for (i=0; i<td->td_alen; i++){
xn = td->td_avec[i];
clicon_xml2cbuf(cb, xn, 0, 0, -1, 0);
if (clixon_xml2cbuf(cb, xn, 0, 0, -1, 0) < 0)
goto done;
}
if (i)
clicon_log(level, "%s %" PRIu64 " %s add: %s", __FUNCTION__, td->td_id, op, cbuf_get(cb));
@ -272,10 +274,12 @@ transaction_log(clicon_handle h,
for (i=0; i<td->td_clen; i++){
if (td->td_scvec){
xn = td->td_scvec[i];
clicon_xml2cbuf(cb, xn, 0, 0, -1, 0);
if (clixon_xml2cbuf(cb, xn, 0, 0, -1, 0) < 0)
goto done;
}
xn = td->td_tcvec[i];
clicon_xml2cbuf(cb, xn, 0, 0, -1, 0);
if (clixon_xml2cbuf(cb, xn, 0, 0, -1, 0) < 0)
goto done;
}
if (i)
clicon_log(level, "%s %" PRIu64 " %s change: %s", __FUNCTION__, td->td_id, op, cbuf_get(cb));