Append prefix before cloning
This commit is contained in:
parent
197fc16e69
commit
c1bcef37a7
1 changed files with 18 additions and 3 deletions
|
|
@ -227,8 +227,23 @@ json_current_clone(clixon_json_yacc *jy)
|
||||||
}
|
}
|
||||||
xn = jy->jy_current;
|
xn = jy->jy_current;
|
||||||
json_current_pop(jy);
|
json_current_pop(jy);
|
||||||
if (jy->jy_current)
|
|
||||||
json_current_new(jy, xml_name(xn));
|
if (jy->jy_current) {
|
||||||
|
char* name = xml_name(xn);
|
||||||
|
char* prefix = xml_prefix(xn);
|
||||||
|
char* maybe_prefixed_name = NULL;
|
||||||
|
|
||||||
|
if (prefix) {
|
||||||
|
char* name_parts[] = {prefix, name};
|
||||||
|
maybe_prefixed_name = clicon_strjoin(2, name_parts, ":");
|
||||||
|
} else {
|
||||||
|
maybe_prefixed_name = strdup(name);
|
||||||
|
}
|
||||||
|
json_current_new(jy, maybe_prefixed_name);
|
||||||
|
|
||||||
|
if (maybe_prefixed_name)
|
||||||
|
free(maybe_prefixed_name);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue