Fixed IDENTITYREF_KLUDGE removal #2

This commit is contained in:
Olof hagsand 2022-11-07 09:19:29 +01:00
parent b0f898cf66
commit 4b21a05bcc
5 changed files with 62 additions and 17 deletions

View file

@ -163,7 +163,6 @@ check_body_namespace(cxobj *x0,
cxobj *x;
int isroot;
cbuf *cberr = NULL;
int ret;
/* XXX: need to identify root better than hiereustics and strcmp,... */
isroot = xml_parent(x0p)==NULL &&
@ -221,6 +220,7 @@ bad-attribue?
#endif
else{ /* Namespace does not exist in x0: error */
#ifdef IDENTITYREF_KLUDGE
int ret;
if (ns1 == NULL){
if ((ret = yang_find_namespace_by_prefix(y, prefix, &ns0)) < 0)
goto done;

View file

@ -347,17 +347,11 @@ json2xml_decode_identityref(cxobj *x,
__FUNCTION__, prefix, body, ns);
if (!xml_nsctx_get_prefix(nsc, ns, &prefix2)){
/* (no) insert a xmlns:<prefix> statement
* Get yang prefix from import statement of my mod */
if (yang_find_prefix_by_namespace(y, ns, &prefix2) == 0){
#ifndef IDENTITYREF_KLUDGE
/* Just get the prefix from the module's own namespace */
if (xerr && netconf_unknown_namespace_xml(xerr, "application",
ns,
"No local prefix corresponding to namespace") < 0)
goto done;
goto fail;
#endif
}
* Get yang prefix from import statement of my mod
* I am not sure this is correct
*/
if (yang_find_prefix_by_namespace(y, ns, &prefix2) < 0)
goto done;
/* if prefix2 is NULL here, we get the canonical prefix */
if (prefix2 == NULL)
prefix2 = yang_find_myprefix(ymod);