Fixed: [Returning a string while Querying leaf-list for single entry](https://github.com/clicon/clixon/issues/326)

This commit is contained in:
Olof hagsand 2022-05-12 12:04:13 +02:00
parent 7065d6f760
commit 0c81b66ef3
6 changed files with 66 additions and 8 deletions

View file

@ -145,12 +145,20 @@ main(int argc,
xml_print(stderr, xerr);
goto done;
}
#if 0
if (json)
xml2json_cbuf(cb, xt, pretty); /* print json */
else
clicon_xml2cbuf(cb, xt, 0, pretty, -1); /* print xml */
#else
xc = NULL;
/* XXX This is troublesome for JSON top-level lists */
while ((xc = xml_child_each(xt, xc, -1)) != NULL)
if (json)
xml2json_cbuf(cb, xc, pretty); /* print xml */
xml2json_cbuf(cb, xc, pretty); /* print json */
else
clicon_xml2cbuf(cb, xc, 0, pretty, -1); /* print xml */
#endif
fprintf(stdout, "%s", cbuf_get(cb));
fflush(stdout);
retval = 0;