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

@ -225,11 +225,11 @@ api_data_get2(clicon_handle h,
if (xpath==NULL || strcmp(xpath,"/")==0){ /* Special case: data root */
switch (media_out){
case YANG_DATA_XML:
if (clicon_xml2cbuf(cbx, xret, 0, pretty, -1, 0) < 0) /* Dont print top object? */
if (clixon_xml2cbuf(cbx, xret, 0, pretty, -1, 0) < 0) /* Dont print top object? */
goto done;
break;
case YANG_DATA_JSON:
if (xml2json_cbuf(cbx, xret, pretty, 0) < 0)
if (clixon_json2cbuf(cbx, xret, pretty, 0) < 0)
goto done;
break;
default:
@ -270,7 +270,7 @@ api_data_get2(clicon_handle h,
if (namespace && xmlns_set(x, prefix, namespace) < 0)
goto done;
}
if (clicon_xml2cbuf(cbx, x, 0, pretty, -1, 0) < 0) /* Dont print top object? */
if (clixon_xml2cbuf(cbx, x, 0, pretty, -1, 0) < 0) /* Dont print top object? */
goto done;
}
break;
@ -535,7 +535,7 @@ api_data_pagination(clicon_handle h,
if (xml_insert(xpr, xp, INS_LAST, NULL, NULL) < 0)
goto done;
}
if (clicon_xml2cbuf(cbx, xpr, 0, pretty, -1, 0) < 0) /* Dont print top object? */
if (clixon_xml2cbuf(cbx, xpr, 0, pretty, -1, 0) < 0) /* Dont print top object? */
goto done;
break;
case YANG_DATA_JSON: