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:
Olof hagsand 2022-06-01 10:48:39 +02:00
parent 724b94137f
commit 43a57dad79
39 changed files with 306 additions and 481 deletions

View file

@ -256,7 +256,7 @@ transaction_log(clicon_handle h,
}
for (i=0; i<td->td_dlen; i++){
xn = td->td_dvec[i];
clicon_xml2cbuf(cb, xn, 0, 0, -1);
clicon_xml2cbuf(cb, xn, 0, 0, -1, 0);
}
if (i)
clicon_log(level, "%s %" PRIu64 " %s del: %s",
@ -264,7 +264,7 @@ transaction_log(clicon_handle h,
cbuf_reset(cb);
for (i=0; i<td->td_alen; i++){
xn = td->td_avec[i];
clicon_xml2cbuf(cb, xn, 0, 0, -1);
clicon_xml2cbuf(cb, xn, 0, 0, -1, 0);
}
if (i)
clicon_log(level, "%s %" PRIu64 " %s add: %s", __FUNCTION__, td->td_id, op, cbuf_get(cb));
@ -272,10 +272,10 @@ transaction_log(clicon_handle h,
for (i=0; i<td->td_clen; i++){
if (td->td_scvec){
xn = td->td_scvec[i];
clicon_xml2cbuf(cb, xn, 0, 0, -1);
clicon_xml2cbuf(cb, xn, 0, 0, -1, 0);
}
xn = td->td_tcvec[i];
clicon_xml2cbuf(cb, xn, 0, 0, -1);
clicon_xml2cbuf(cb, xn, 0, 0, -1, 0);
}
if (i)
clicon_log(level, "%s %" PRIu64 " %s change: %s", __FUNCTION__, td->td_id, op, cbuf_get(cb));