* C-API change: xml_new() changed from xml_new(name, xp, ys) to xml_new(name, prefix, xp, type)

* If you have used, `ys`, add `xml_spec_set(x, ys)` after the statement
  * If you have `xml_type_set(x, TYPE)` or `xml_prefix_set(x, PREFIX)` immediately after the statement, you can remove those and set them directly as: `xml_new(name, PREFIX, xp, TYPE)`
This commit is contained in:
Olof hagsand 2020-03-12 22:29:28 +01:00
parent 71efe18f94
commit 7425a3b520
26 changed files with 135 additions and 155 deletions

View file

@ -345,10 +345,7 @@ json2xml_decode_identityref(cxobj *x,
if (prefix2 == NULL)
prefix2 = yang_find_myprefix(ymod);
/* Add "xmlns:prefix2=namespace" */
if ((xa = xml_new(prefix2, x, NULL)) == NULL)
goto done;
xml_type_set(xa, CX_ATTR);
if (xml_prefix_set(xa, "xmlns") < 0)
if ((xa = xml_new(prefix2, "xmlns", x, CX_ATTR)) == NULL)
goto done;
if (xml_value_set(xa, namespace) < 0)
goto done;
@ -968,7 +965,7 @@ xml2json_cbuf_vec(cbuf *cb,
cxobj *xc;
cvec *nsc = NULL;
if ((xp = xml_new("xml2json", NULL, NULL)) == NULL)
if ((xp = xml_new("xml2json", NULL, NULL, CX_ELMNT)) == NULL)
goto done;
/* Make a copy of old and graft it into new top-object
* Also copy namespace context */
@ -1298,7 +1295,7 @@ json_parse_str2(char *str,
return -1;
}
if (*xt == NULL){
if ((*xt = xml_new("top", NULL, NULL)) == NULL)
if ((*xt = xml_new("top", NULL, NULL, CX_ELMNT)) == NULL)
return -1;
}
return _json_parse(str, yb, yspec, *xt, xerr);
@ -1319,7 +1316,7 @@ json_parse_str(char *str,
}
if (*xt == NULL){
yb = YB_TOP; /* ad-hoc #1 */
if ((*xt = xml_new("top", NULL, NULL)) == NULL)
if ((*xt = xml_new("top", NULL, NULL, CX_ELMNT)) == NULL)
return -1;
}
else{
@ -1400,7 +1397,7 @@ json_parse_file(int fd,
jsonbuf[len++] = ch;
if (ret == 0){
if (*xt == NULL)
if ((*xt = xml_new(JSON_TOP_SYMBOL, NULL, NULL)) == NULL)
if ((*xt = xml_new(JSON_TOP_SYMBOL, NULL, NULL, CX_ELMNT)) == NULL)
goto done;
if (len){
if ((ret = _json_parse(ptr, yb, yspec, *xt, xerr)) < 0)