json parser

This commit is contained in:
Olof hagsand 2016-08-15 09:29:22 +02:00
parent 20087932c5
commit 887d43428b
15 changed files with 830 additions and 209 deletions

View file

@ -68,6 +68,7 @@
#include <clixon/clixon_xml_map.h>
#include <clixon/clixon_xml_db.h>
#include <clixon/clixon_xsl.h>
#include <clixon/clixon_json.h>
#include <clixon/clixon_plugin.h>
#include <clixon/clixon_plugin.h>

34
lib/clixon/clixon_json.h Normal file
View file

@ -0,0 +1,34 @@
/*
*
Copyright (C) 2009-2016 Olof Hagsand and Benny Holmgren
This file is part of CLIXON.
CLIXON is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
CLIXON is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CLIXON; see the file LICENSE. If not, see
<http://www.gnu.org/licenses/>.
* JSON support functions.
*/
#ifndef _CLIXON_JSON_H
#define _CLIXON_JSON_H
/*
* Prototypes
*/
int json_parse_str(char *str, cxobj **xt);
int xml2json_cbuf(cbuf *cb, cxobj *x, int level);
int xml2json(FILE *f, cxobj *x, int level);
#endif /* _CLIXON_JSON_H */

View file

@ -108,7 +108,9 @@ int xml_print(FILE *f, cxobj *xn);
int clicon_xml2file(FILE *f, cxobj *xn, int level, int prettyprint);
int clicon_xml2cbuf(cbuf *xf, cxobj *xn, int level, int prettyprint);
int clicon_xml_parse_file(int fd, cxobj **xml_top, char *endtag);
int clicon_xml_parse_string(char **str, cxobj **xml_top);
/* XXX obsolete */
#define clicon_xml_parse_string(str, x) clicon_xml_parse_str((*str), x)
int clicon_xml_parse_str(char *str, cxobj **xml_top);
int xml_copy(cxobj *x0, cxobj *x1);
cxobj *xml_dup(cxobj *x0);

View file

@ -41,8 +41,6 @@ enum {
*/
int xml2txt(FILE *f, cxobj *x, int level);
int xml2cli(FILE *f, cxobj *x, char *prepend, enum genmodel_type gt, const char *label);
int xml2json_cbuf(cbuf *cb, cxobj *x, int level);
int xml2json(FILE *f, cxobj *x, int level);
int xml_yang_validate(cxobj *xt, yang_stmt *ys) ;
int xml2cvec(cxobj *xt, yang_stmt *ys, cvec **cvv0);
int cvec2xml_1(cvec *cvv, char *toptag, cxobj *xp, cxobj **xt0);