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:
parent
87719c623c
commit
0c79298e76
49 changed files with 421 additions and 503 deletions
|
|
@ -279,13 +279,13 @@ api_return_err(clicon_handle h,
|
|||
clicon_debug(1, "%s code:%d", __FUNCTION__, code);
|
||||
if (pretty){
|
||||
cprintf(cb, " <errors xmlns=\"urn:ietf:params:xml:ns:yang:ietf-restconf\">\n");
|
||||
if (clicon_xml2cbuf(cb, xerr, 2, pretty, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, xerr, 2, pretty, -1, 0) < 0)
|
||||
goto done;
|
||||
cprintf(cb, " </errors>\r\n");
|
||||
}
|
||||
else {
|
||||
cprintf(cb, "<errors xmlns=\"urn:ietf:params:xml:ns:yang:ietf-restconf\">");
|
||||
if (clicon_xml2cbuf(cb, xerr, 2, pretty, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, xerr, 2, pretty, -1, 0) < 0)
|
||||
goto done;
|
||||
cprintf(cb, "</errors>\r\n");
|
||||
}
|
||||
|
|
@ -295,14 +295,14 @@ api_return_err(clicon_handle h,
|
|||
clicon_debug(1, "%s code:%d", __FUNCTION__, code);
|
||||
if (pretty){
|
||||
cprintf(cb, "{\n\"ietf-restconf:errors\" : ");
|
||||
if (xml2json_cbuf(cb, xerr, pretty, 0) < 0)
|
||||
if (clixon_json2cbuf(cb, xerr, pretty, 0) < 0)
|
||||
goto done;
|
||||
cprintf(cb, "\n}\r\n");
|
||||
}
|
||||
else{
|
||||
cprintf(cb, "{");
|
||||
cprintf(cb, "\"ietf-restconf:errors\":");
|
||||
if (xml2json_cbuf(cb, xerr, pretty, 0) < 0)
|
||||
if (clixon_json2cbuf(cb, xerr, pretty, 0) < 0)
|
||||
goto done;
|
||||
cprintf(cb, "}\r\n");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue