Changed C-API for xml translation/print to other formats.
* Added `skiptop` parameter, if set only apply to children of a node, skip top node
* default is 0
* Functions are merged, ie removed and replaced with more generic functions
* `xml2json_cbuf()`: Added `skiptop` parameter: `xml2json_cbuf(..., int skiptop)`
* `xml2json()` and `xml2json_cb()` merged into `xml2json_file()` with `skiptop`
* Replace `xml2json(...)` with `xml2json_file(..., stdout, 0)`
* Replace `xml2json_cb(...)` with `xml2json_file(..., 0)`
* `clicon_xml2cbuf()`: Added `skiptop` parameter: `clicon_xml2cbuf(..., int skiptop)`
* `xml2cli()`: Added `skiptop` parameter: `xml2cli(..., int skiptop)`
This commit is contained in:
parent
724b94137f
commit
43a57dad79
39 changed files with 306 additions and 481 deletions
|
|
@ -1206,7 +1206,7 @@ xmldb_put(clicon_handle h,
|
|||
}
|
||||
pretty = clicon_option_bool(h, "CLICON_XMLDB_PRETTY");
|
||||
if (strcmp(format,"json")==0){
|
||||
if (xml2json(f, x0, pretty) < 0)
|
||||
if (xml2json_file(f, x0, pretty, fprintf, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
else if (clicon_xml2file(f, x0, 0, pretty) < 0)
|
||||
|
|
@ -1264,7 +1264,7 @@ xmldb_dump(clicon_handle h,
|
|||
}
|
||||
pretty = clicon_option_bool(h, "CLICON_XMLDB_PRETTY");
|
||||
if (strcmp(format,"json")==0){
|
||||
if (xml2json(f, xt, pretty) < 0)
|
||||
if (xml2json_file(f, xt, pretty, fprintf, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
else if (clicon_xml2file(f, xt, 0, pretty) < 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue