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

@ -745,7 +745,8 @@ xmldb_get_nocache(clicon_handle h,
clicon_log(LOG_NOTICE, "%s: sort verify failed #2", __FUNCTION__);
#endif
if (clicon_debug_get()>1)
clicon_xml2file(stderr, xt, 0, 1);
if (clixon_xml2file(stderr, xt, 0, 1, fprintf, 0) < 0)
goto done;
*xtop = xt;
xt = NULL;
retval = 1;
@ -916,7 +917,8 @@ xmldb_get_cache(clicon_handle h,
* If cache was empty, also update to datastore cache
*/
if (clicon_debug_get()>1)
clicon_xml2file(stderr, x1t, 0, 1);
if (clixon_xml2file(stderr, x1t, 0, 1, fprintf, 0) < 0)
goto done;
*xtop = x1t;
retval = 1;
done:
@ -1016,8 +1018,9 @@ xmldb_get_zerocopy(clicon_handle h,
if (disable_nacm_on_empty(x0t, yspec) < 0)
goto done;
}
if (clicon_debug_get()>1)
clicon_xml2file(stderr, x0t, 0, 1);
if (clicon_debug_get() > 1)
if (clixon_xml2file(stderr, x0t, 0, 1, fprintf, 0) < 0)
goto done;
*xtop = x0t;
retval = 1;
done: