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

@ -74,7 +74,8 @@ mycallback(clicon_handle h, cvec *cvv, cvec *argv)
nsc,
&xret) < 0)
goto done;
clicon_xml2file_cb(stdout, xret, 0, 1, cligen_output);
if (clixon_xml2file(stdout, xret, 0, 1, cligen_output, 0) < 0)
goto done;
retval = 0;
done:
if (nsc)
@ -118,11 +119,12 @@ example_client_rpc(clicon_handle h,
goto done;
}
/* Print result */
clicon_xml2file_cb(stdout, xml_child_i(xret, 0), 0, 0, cligen_output);
if (clixon_xml2file(stdout, xml_child_i(xret, 0), 0, 0, cligen_output, 0) < 0)
goto done;
fprintf(stdout,"\n");
/* pretty-print:
xml2txt(xml_child_i(xret, 0), cligen_output, stdout, 0);
clixon_txt2file(stdout, xml_child_i(xret, 0), 0, cligen_output, 0);
*/
retval = 0;
done: