XML printer REFACTOR unify/simplify way of getting libyang context from a data node
diff --git a/src/printer_xml.c b/src/printer_xml.c
index aa4b35b..32114f5 100644
--- a/src/printer_xml.c
+++ b/src/printer_xml.c
@@ -182,7 +182,7 @@
         if (((node->flags & LYD_DEFAULT) && (ctx->options & (LYD_PRINT_WD_ALL_TAG | LYD_PRINT_WD_IMPL_TAG))) ||
                 ((ctx->options & LYD_PRINT_WD_ALL_TAG) && lyd_is_default(node))) {
             /* we have implicit OR explicit default node, print attribute only if context include with-defaults schema */
-            mod = ly_ctx_get_module_latest(node->schema->module->ctx, "ietf-netconf-with-defaults");
+            mod = ly_ctx_get_module_latest(LYD_CTX(node), "ietf-netconf-with-defaults");
             if (mod) {
                 ly_print_(ctx->out, " %s:default=\"true\"", xml_print_ns(ctx, mod->ns, mod->prefix, 0));
             }