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

@ -91,14 +91,16 @@ static int
ctx_print2(cbuf *cb,
xp_ctx *xc)
{
int i;
int retval = -1;
int i;
cprintf(cb, "%s:", (char*)clicon_int2str(ctxmap, xc->xc_type));
switch (xc->xc_type){
case XT_NODESET:
for (i=0; i<xc->xc_size; i++){
cprintf(cb, "%d:", i);
clicon_xml2cbuf(cb, xc->xc_nodeset[i], 0, 0, -1, 0);
if (clixon_xml2cbuf(cb, xc->xc_nodeset[i], 0, 0, -1, 0) < 0)
goto done;
}
break;
case XT_BOOL:
@ -111,7 +113,9 @@ ctx_print2(cbuf *cb,
cprintf(cb, "%s", xc->xc_string);
break;
}
return 0;
retval = 0;
done:
return retval;
}
int