Skip to content

Commit eac9eeb

Browse files
committed
printer xml BUGFIX default metadata ns changed
1 parent 3ac8be1 commit eac9eeb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/printer_xml.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static void
193193
xml_print_meta(struct xmlpr_ctx *pctx, const struct lyd_node *node)
194194
{
195195
struct lyd_meta *meta;
196-
const struct lys_module *mod;
196+
const struct lys_module *df_mod = NULL, *mod;
197197
struct ly_set ns_list = {0};
198198
LY_ARRAY_COUNT_TYPE u;
199199
ly_bool dynamic, filter_attrs = 0;
@@ -205,9 +205,11 @@ xml_print_meta(struct xmlpr_ctx *pctx, const struct lyd_node *node)
205205
if (((node->flags & LYD_DEFAULT) && (pctx->options & (LYD_PRINT_WD_ALL_TAG | LYD_PRINT_WD_IMPL_TAG))) ||
206206
((pctx->options & LYD_PRINT_WD_ALL_TAG) && lyd_is_default(node))) {
207207
/* we have implicit OR explicit default node, print attribute only if context include with-defaults schema */
208-
mod = ly_ctx_get_module_latest(LYD_CTX(node), "ietf-netconf-with-defaults");
209-
if (mod) {
210-
ly_print_(pctx->out, " %s:default=\"true\"", xml_print_ns(pctx, mod->ns, mod->prefix, 0));
208+
if (ly_ctx_get_module_latest(LYD_CTX(node), "ietf-netconf-with-defaults")) {
209+
df_mod = ly_ctx_get_module_latest(LYD_CTX(node), "default");
210+
}
211+
if (df_mod) {
212+
ly_print_(pctx->out, " %s:default=\"true\"", xml_print_ns(pctx, df_mod->ns, df_mod->prefix, 0));
211213
}
212214
}
213215
}

0 commit comments

Comments
 (0)