diff --git a/src/parser_xml.c b/src/parser_xml.c
index a3c8acf..ffca41f 100644
--- a/src/parser_xml.c
+++ b/src/parser_xml.c
@@ -31,21 +31,37 @@
 
 /**
  * @brief Internal context for XML YANG data parser.
+ *
+ * Note that the structure maps to the lyd_ctx which is common for all the data parsers
  */
 struct lyd_xml_ctx {
-    struct lyxml_ctx *xmlctx;        /**< XML context */
+    uint32_t parse_options;        /**< various @ref dataparseroptions. */
+    uint32_t validate_options;     /**< various @ref datavalidationoptions. */
+    uint32_t int_opts;             /**< internal data parser options */
+    uint32_t path_len;             /**< used bytes in the path buffer */
+    char path[LYD_PARSER_BUFSIZE]; /**< buffer for the generated path */
+    struct ly_set unres_node_type; /**< set of nodes validated with LY_EINCOMPLETE result */
+    struct ly_set unres_meta_type; /**< set of metadata validated with LY_EINCOMPLETE result */
+    struct ly_set when_check;      /**< set of nodes with "when" conditions */
+    struct lyd_node *op_node;      /**< if an RPC/action/notification is being parsed, store the pointer to it */
 
-    uint32_t options;                /**< various @ref dataparseroptions. */
-    uint32_t int_opts;               /**< internal data parser options */
-    uint32_t path_len;               /**< used bytes in the path buffer */
-#define LYD_PARSER_BUFSIZE 4078
-    char path[LYD_PARSER_BUFSIZE];   /**< buffer for the generated path */
-    struct ly_set unres_node_type;   /**< set of nodes validated with LY_EINCOMPLETE result */
-    struct ly_set unres_meta_type;   /**< set of metadata validated with LY_EINCOMPLETE result */
-    struct ly_set when_check;        /**< set of nodes with "when" conditions */
-    struct lyd_node *op_ntf;         /**< if an RPC/action/notification is being parsed, store the pointer to it */
+    /* callbacks */
+    lyd_ctx_free_clb free;           /* destructor */
+    ly_resolve_prefix_clb resolve_prefix;
+
+    struct lyxml_ctx *xmlctx;      /**< XML context */
 };
 
+void
+lyd_xml_ctx_free(struct lyd_ctx *lydctx)
+{
+    struct lyd_xml_ctx *ctx = (struct lyd_xml_ctx *)lydctx;
+
+    lyd_ctx_free(lydctx);
+    lyxml_ctx_free(ctx->xmlctx);
+    free(ctx);
+}
+
 /**
  * @brief XML-parser's implementation of ly_type_resolve_prefix() callback to provide mapping between prefixes used
  * in the values to the schema via XML namespaces.
@@ -65,14 +81,14 @@
 }
 
 static LY_ERR
-lydxml_metadata(struct lyxml_ctx *xmlctx, const struct lysc_node *sparent, int strict, struct ly_set *unres_meta_type,
-                struct lyd_meta **meta)
+lydxml_metadata(struct lyd_xml_ctx *lydctx, const struct lysc_node *sparent, struct lyd_meta **meta)
 {
     LY_ERR ret = LY_EVALID;
     const struct lyxml_ns *ns;
     struct lys_module *mod;
     const char *name;
     size_t name_len;
+    struct lyxml_ctx *xmlctx = lydctx->xmlctx;
 
     *meta = NULL;
 
@@ -80,7 +96,7 @@
         if (!xmlctx->prefix_len) {
             /* in XML, all attributes must be prefixed
              * TODO exception for NETCONF filters which are supposed to map to the ietf-netconf without prefix */
-            if (strict) {
+            if (lydctx->parse_options & LYD_PARSE_STRICT) {
                 LOGVAL(xmlctx->ctx, LY_VLOG_LINE, &xmlctx->line, LYVE_REFERENCE, "Missing mandatory prefix for XML metadata \"%.*s\".",
                        xmlctx->name_len, xmlctx->name);
                 goto cleanup;
@@ -104,7 +120,7 @@
         mod = ly_ctx_get_module_implemented_ns(xmlctx->ctx, ns->uri);
         if (!mod) {
             /* module is not implemented or not present in the schema */
-            if (strict) {
+            if (lydctx->parse_options & LYD_PARSE_STRICT) {
                 LOGVAL(xmlctx->ctx, LY_VLOG_LINE, &xmlctx->line, LYVE_REFERENCE,
                        "Unknown (or not implemented) YANG module with namespace \"%s\" for metadata \"%.*s%s%.*s\".",
                        ns->uri, xmlctx->prefix_len, xmlctx->prefix, xmlctx->prefix_len ? ":" : "", xmlctx->name_len,
@@ -121,15 +137,9 @@
         assert(xmlctx->status == LYXML_ATTR_CONTENT);
 
         /* create metadata */
-        ret = lyd_create_meta(NULL, meta, mod, name, name_len, xmlctx->value, xmlctx->value_len, &xmlctx->dynamic,
-                              lydxml_resolve_prefix, xmlctx, LYD_XML, sparent);
-        if (ret == LY_EINCOMPLETE) {
-            if (unres_meta_type) {
-                ly_set_add(unres_meta_type, *meta, LY_SET_OPT_USEASLIST);
-            }
-        } else if (ret) {
-            goto cleanup;
-        }
+        ret = lyd_parser_create_meta((struct lyd_ctx*)lydctx, NULL, meta, mod, name, name_len, xmlctx->value, xmlctx->value_len,
+                                     &xmlctx->dynamic, 0, lydxml_resolve_prefix, xmlctx, LYD_XML, sparent);
+        LY_CHECK_GOTO(ret, cleanup);
 
         /* next attribute */
         LY_CHECK_GOTO(ret = lyxml_ctx_next(xmlctx), cleanup);
@@ -146,12 +156,12 @@
 }
 
 static LY_ERR
-lydxml_attrs(struct lyxml_ctx *xmlctx, struct ly_attr **attr)
+lydxml_attrs(struct lyxml_ctx *xmlctx, struct lyd_attr **attr)
 {
     LY_ERR ret = LY_SUCCESS;
     const struct lyxml_ns *ns;
     struct ly_prefix *val_prefs;
-    struct ly_attr *attr2;
+    struct lyd_attr *attr2;
     const char *name, *prefix;
     size_t name_len, prefix_len;
 
@@ -189,8 +199,9 @@
         LY_CHECK_GOTO(ret = lyxml_get_prefixes(xmlctx, xmlctx->value, xmlctx->value_len, &val_prefs), cleanup);
 
         /* attr2 is always changed to the created attribute */
-        ret = ly_create_attr(NULL, &attr2, xmlctx->ctx, name, name_len, xmlctx->value, xmlctx->value_len,
-                             &xmlctx->dynamic, LYD_XML, val_prefs, prefix, prefix_len, ns ? ns->uri : NULL);
+        ret = lyd_create_attr(NULL, &attr2, xmlctx->ctx, name, name_len, xmlctx->value, xmlctx->value_len,
+                              &xmlctx->dynamic, 0, LYD_XML, val_prefs, prefix, prefix_len,
+                              ns ? ns->uri : NULL, ns ? strlen(ns->uri) : 0);
         LY_CHECK_GOTO(ret, cleanup);
 
         if (!*attr) {
@@ -307,7 +318,7 @@
 }
 
 static LY_ERR
-lydxml_data_check_schema(struct lyd_xml_ctx *lydctx, const struct lysc_node **snode)
+lydxml_data_check_opaq(struct lyd_xml_ctx *lydctx, const struct lysc_node **snode)
 {
     LY_ERR ret = LY_SUCCESS;
     enum LYXML_PARSER_STATUS prev_status;
@@ -315,40 +326,7 @@
     size_t pprefix_len, pname_len;
     struct lyxml_ctx *xmlctx = lydctx->xmlctx;
 
-    if ((lydctx->options & LYD_PARSE_NO_STATE) && ((*snode)->flags & LYS_CONFIG_R)) {
-        LOGVAL(xmlctx->ctx, LY_VLOG_LINE, &xmlctx->line, LY_VCODE_INNODE, "state", (*snode)->name);
-        return LY_EVALID;
-    }
-
-    if ((*snode)->nodetype & (LYS_RPC | LYS_ACTION)) {
-        if (lydctx->int_opts & LYD_INTOPT_RPC) {
-            if (lydctx->op_ntf) {
-                LOGVAL(xmlctx->ctx, LY_VLOG_LINE, &xmlctx->line, LYVE_DATA, "Unexpected %s element \"%s\", %s \"%s\" already parsed.",
-                       lys_nodetype2str((*snode)->nodetype), (*snode)->name,
-                       lys_nodetype2str(lydctx->op_ntf->schema->nodetype), lydctx->op_ntf->schema->name);
-                return LY_EVALID;
-            }
-        } else {
-            LOGVAL(xmlctx->ctx, LY_VLOG_LINE, &xmlctx->line, LYVE_DATA, "Unexpected %s element \"%s\".",
-                   lys_nodetype2str((*snode)->nodetype), (*snode)->name);
-            return LY_EVALID;
-        }
-    } else if ((*snode)->nodetype == LYS_NOTIF) {
-        if (lydctx->int_opts & LYD_INTOPT_NOTIF) {
-            if (lydctx->op_ntf) {
-                LOGVAL(xmlctx->ctx, LY_VLOG_LINE, &xmlctx->line, LYVE_DATA, "Unexpected %s element \"%s\", %s \"%s\" already parsed.",
-                       lys_nodetype2str((*snode)->nodetype), (*snode)->name,
-                       lys_nodetype2str(lydctx->op_ntf->schema->nodetype), lydctx->op_ntf->schema->name);
-                return LY_EVALID;
-            }
-        } else {
-            LOGVAL(xmlctx->ctx, LY_VLOG_LINE, &xmlctx->line, LYVE_DATA, "Unexpected %s element \"%s\".",
-                   lys_nodetype2str((*snode)->nodetype), (*snode)->name);
-            return LY_EVALID;
-        }
-    }
-
-    if ((lydctx->options & LYD_PARSE_OPAQ) && ((*snode)->nodetype & (LYD_NODE_TERM | LYS_LIST))) {
+    if ((lydctx->parse_options & LYD_PARSE_OPAQ) && ((*snode)->nodetype & (LYD_NODE_TERM | LYS_LIST))) {
         /* backup parser */
         prev_status = xmlctx->status;
         pprefix = xmlctx->prefix;
@@ -416,7 +394,7 @@
     const struct ly_ctx *ctx;
     const struct lyxml_ns *ns;
     struct lyd_meta *meta = NULL, *m;
-    struct ly_attr *attr = NULL, *a;
+    struct lyd_attr *attr = NULL, *a;
     const struct lysc_node *snode;
     struct lys_module *mod;
     uint32_t prev_opts;
@@ -446,13 +424,13 @@
         }
         mod = ly_ctx_get_module_implemented_ns(ctx, ns->uri);
         if (!mod) {
-            if (lydctx->options & LYD_PARSE_STRICT) {
+            if (lydctx->parse_options & LYD_PARSE_STRICT) {
                 LOGVAL(ctx, LY_VLOG_LINE, &xmlctx->line, LYVE_REFERENCE, "No module with namespace \"%s\" in the context.",
                        ns->uri);
                 ret = LY_EVALID;
                 goto cleanup;
             }
-            if (!(lydctx->options & LYD_PARSE_OPAQ)) {
+            if (!(lydctx->parse_options & LYD_PARSE_OPAQ)) {
                 /* skip element with children */
                 LY_CHECK_GOTO(ret = lydxml_data_skip(xmlctx), cleanup);
                 continue;
@@ -467,29 +445,30 @@
         if (mod && (!parent || parent->schema)) {
             snode = lys_find_child(parent ? parent->schema : NULL, mod, name, name_len, 0, getnext_opts);
             if (!snode) {
-                if (lydctx->options & LYD_PARSE_STRICT) {
+                if (lydctx->parse_options & LYD_PARSE_STRICT) {
                     LOGVAL(ctx, LY_VLOG_LINE, &xmlctx->line, LYVE_REFERENCE, "Element \"%.*s\" not found in the \"%s\" module.",
                         name_len, name, mod->name);
                     ret = LY_EVALID;
                     goto cleanup;
-                } else if (!(lydctx->options & LYD_PARSE_OPAQ)) {
+                } else if (!(lydctx->parse_options & LYD_PARSE_OPAQ)) {
                     /* skip element with children */
                     LY_CHECK_GOTO(ret = lydxml_data_skip(xmlctx), cleanup);
                     continue;
                 }
             } else {
                 /* check that schema node is valid and can be used */
-                LY_CHECK_GOTO(ret = lydxml_data_check_schema(lydctx, &snode), cleanup);
+                LY_CHECK_GOTO(ret = lyd_parser_check_schema((struct lyd_ctx *)lydctx, snode), cleanup);
+                LY_CHECK_GOTO(ret = lydxml_data_check_opaq(lydctx, &snode), cleanup);
             }
         }
 
         /* create metadata/attributes */
         if (xmlctx->status == LYXML_ATTRIBUTE) {
             if (snode) {
-                ret = lydxml_metadata(xmlctx, snode, lydctx->options & LYD_PARSE_STRICT, &lydctx->unres_meta_type, &meta);
+                ret = lydxml_metadata(lydctx, snode, &meta);
                 LY_CHECK_GOTO(ret, cleanup);
             } else {
-                assert(lydctx->options & LYD_PARSE_OPAQ);
+                assert(lydctx->parse_options & LYD_PARSE_OPAQ);
                 ret = lydxml_attrs(xmlctx, &attr);
                 LY_CHECK_GOTO(ret, cleanup);
             }
@@ -497,7 +476,7 @@
 
         assert(xmlctx->status == LYXML_ELEM_CONTENT);
         if (!snode) {
-            assert(lydctx->options & LYD_PARSE_OPAQ);
+            assert(lydctx->parse_options & LYD_PARSE_OPAQ);
 
             if (xmlctx->ws_only) {
                 /* ignore WS-only value */
@@ -510,8 +489,8 @@
             }
 
             /* create node */
-            ret = lyd_create_opaq(ctx, name, name_len, xmlctx->value, xmlctx->value_len, &xmlctx->dynamic, LYD_XML,
-                                  val_prefs, prefix, prefix_len, ns->uri, &cur);
+            ret = lyd_create_opaq(ctx, name, name_len, xmlctx->value, xmlctx->value_len, &xmlctx->dynamic, 0, LYD_XML,
+                                  val_prefs, prefix, prefix_len, ns->uri, strlen(ns->uri), &cur);
             LY_CHECK_GOTO(ret, cleanup);
 
             /* parser next */
@@ -524,21 +503,14 @@
             }
         } else if (snode->nodetype & LYD_NODE_TERM) {
             /* create node */
-            ret = lyd_create_term(snode, xmlctx->value, xmlctx->value_len, &xmlctx->dynamic, lydxml_resolve_prefix,
-                                  xmlctx, LYD_XML, &cur);
-            if (ret == LY_EINCOMPLETE) {
-                if (!(lydctx->options & LYD_PARSE_ONLY)) {
-                    ly_set_add(&lydctx->unres_node_type, cur, LY_SET_OPT_USEASLIST);
-                }
-            } else if (ret) {
-                goto cleanup;
-            }
+            LY_CHECK_GOTO(ret = lyd_parser_create_term((struct lyd_ctx*)lydctx, snode, xmlctx->value, xmlctx->value_len, &xmlctx->dynamic, 0,
+                                                       lydxml_resolve_prefix, xmlctx, LYD_XML, &cur), cleanup);
 
             if (parent && (cur->schema->flags & LYS_KEY)) {
                 /* check the key order, the anchor must never be a key */
                 anchor = lyd_insert_get_next_anchor(parent->child, cur);
                 if (anchor && (anchor->schema->flags & LYS_KEY)) {
-                    if (lydctx->options & LYD_PARSE_STRICT) {
+                    if (lydctx->parse_options & LYD_PARSE_STRICT) {
                         LOGVAL(ctx, LY_VLOG_LINE, &xmlctx->line, LYVE_DATA, "Invalid position of the key \"%s\" in a list.",
                                 cur->schema->name);
                         ret = LY_EVALID;
@@ -586,21 +558,20 @@
                 LY_CHECK_GOTO(ret = lyd_parse_check_keys(cur), cleanup);
             }
 
-            if (!(lydctx->options & LYD_PARSE_ONLY)) {
+            if (!(lydctx->parse_options & LYD_PARSE_ONLY)) {
                 /* new node validation, autodelete CANNOT occur, all nodes are new */
                 ret = lyd_validate_new(lyd_node_children_p(cur), snode, NULL, NULL);
                 LY_CHECK_GOTO(ret, cleanup);
 
                 /* add any missing default children */
-                ret = lyd_new_implicit_r(cur, lyd_node_children_p(cur), NULL, NULL, &lydctx->unres_node_type,
-                                         &lydctx->when_check, (lydctx->options & LYD_VALIDATE_NO_STATE)
-                                            ? LYD_IMPLICIT_NO_STATE : 0, NULL);
+                ret = lyd_new_implicit_r(cur, lyd_node_children_p(cur), NULL, NULL, &lydctx->unres_node_type, &lydctx->when_check,
+                                         (lydctx->validate_options & LYD_VALIDATE_NO_STATE) ? LYD_IMPLICIT_NO_STATE : 0, NULL);
                 LY_CHECK_GOTO(ret, cleanup);
             }
 
             if (snode->nodetype & (LYS_RPC | LYS_ACTION | LYS_NOTIF)) {
                 /* rememeber the RPC/action/notification */
-                lydctx->op_ntf = cur;
+                lydctx->op_node = cur;
             }
         } else if (snode->nodetype & LYD_NODE_ANY) {
             if (!xmlctx->ws_only) {
@@ -615,12 +586,12 @@
             LY_CHECK_GOTO(ret = lyxml_ctx_next(xmlctx), cleanup);
 
             /* parse any data tree with correct options */
-            prev_opts = lydctx->options;
-            lydctx->options &= ~LYD_PARSE_STRICT;
-            lydctx->options |= LYD_PARSE_OPAQ;
+            prev_opts = lydctx->parse_options;
+            lydctx->parse_options &= ~LYD_PARSE_STRICT;
+            lydctx->parse_options |= LYD_PARSE_OPAQ;
             anchor = NULL;
             ret = lydxml_data_r(lydctx, NULL, &anchor);
-            lydctx->options = prev_opts;
+            lydctx->parse_options = prev_opts;
             LY_CHECK_GOTO(ret, cleanup);
 
             /* create node */
@@ -631,7 +602,7 @@
 
         /* add/correct flags */
         if (snode) {
-            lyd_parse_set_data_flags(cur, &lydctx->when_check, &meta, lydctx->options);
+            lyd_parse_set_data_flags(cur, &lydctx->when_check, &meta, lydctx->parse_options);
         }
 
         /* add metadata/attributes */
@@ -677,73 +648,37 @@
 }
 
 LY_ERR
-lyd_parse_xml_data(const struct ly_ctx *ctx, struct ly_in *in, int parse_options, int validate_options, struct lyd_node **tree)
+lyd_parse_xml_data(const struct ly_ctx *ctx, struct ly_in *in, int parse_options, int validate_options, struct lyd_node **tree_p, struct lyd_ctx **lydctx_p)
 {
     LY_ERR ret = LY_SUCCESS;
-    struct lyd_xml_ctx lydctx = {0};
-    uint32_t i = 0;
-    const struct lys_module *mod;
-    struct lyd_node *first, *next, **first2;
+    struct lyd_xml_ctx *lydctx;
 
     assert(!(parse_options & ~LYD_PARSE_OPTS_MASK));
     assert(!(validate_options & ~LYD_VALIDATE_OPTS_MASK));
 
-    /* init context and tree */
-    LY_CHECK_GOTO(ret = lyxml_ctx_new(ctx, in, &lydctx.xmlctx), cleanup);
-    lydctx.options = parse_options;
-    *tree = NULL;
+    /* init context */
+    lydctx = calloc(1, sizeof *lydctx);
+    LY_CHECK_ERR_RET(!lydctx, LOGMEM(ctx), LY_EMEM);
+    LY_CHECK_GOTO(ret = lyxml_ctx_new(ctx, in, &lydctx->xmlctx), cleanup);
+    lydctx->parse_options = parse_options;
+    lydctx->validate_options = validate_options;
+    lydctx->free = lyd_xml_ctx_free;
+    lydctx->resolve_prefix = lydxml_resolve_prefix;
 
     /* parse XML data */
-    LY_CHECK_GOTO(ret = lydxml_data_r(&lydctx, NULL, tree), cleanup);
-
-    if (!(parse_options & LYD_PARSE_ONLY)) {
-        next = *tree;
-        while (1) {
-            if (validate_options & LYD_VALIDATE_PRESENT) {
-                mod = lyd_data_next_module(&next, &first);
-            } else {
-                mod = lyd_mod_next_module(next, NULL, ctx, &i, &first);
-            }
-            if (!mod) {
-                break;
-            }
-            if (first == *tree) {
-                /* make sure first2 changes are carried to tree */
-                first2 = tree;
-            } else {
-                first2 = &first;
-            }
-
-            /* validate new top-level nodes, autodelete CANNOT occur, all nodes are new */
-            LY_CHECK_GOTO(ret = lyd_validate_new(first2, NULL, mod, NULL), cleanup);
-
-            /* add all top-level defaults for this module */
-            ret = lyd_new_implicit_r(NULL, first2, NULL, mod, &lydctx.unres_node_type, &lydctx.when_check,
-                                     validate_options & LYD_VALIDATE_NO_STATE ? LYD_IMPLICIT_NO_STATE : 0, NULL);
-            LY_CHECK_GOTO(ret, cleanup);
-
-            /* finish incompletely validated terminal values/attributes and when conditions */
-            ret = lyd_validate_unres(tree, &lydctx.when_check, &lydctx.unres_node_type, &lydctx.unres_meta_type, LYD_XML,
-                                     lydxml_resolve_prefix, lydctx.xmlctx, NULL);
-            LY_CHECK_GOTO(ret, cleanup);
-
-            /* perform final validation that assumes the data tree is final */
-            LY_CHECK_GOTO(ret = lyd_validate_final_r(*first2, NULL, mod, validate_options, 0), cleanup);
-        }
-    }
+    LY_CHECK_GOTO(ret = lydxml_data_r(lydctx, NULL, tree_p), cleanup);
 
 cleanup:
     /* there should be no unresolved types stored */
-    assert(!(parse_options & LYD_PARSE_ONLY) || (!lydctx.unres_node_type.count && !lydctx.unres_meta_type.count
-           && !lydctx.when_check.count));
+    assert(!(parse_options & LYD_PARSE_ONLY) || (!lydctx->unres_node_type.count && !lydctx->unres_meta_type.count
+           && !lydctx->when_check.count));
 
-    ly_set_erase(&lydctx.unres_node_type, NULL);
-    ly_set_erase(&lydctx.unres_meta_type, NULL);
-    ly_set_erase(&lydctx.when_check, NULL);
-    lyxml_ctx_free(lydctx.xmlctx);
     if (ret) {
-        lyd_free_all(*tree);
-        *tree = NULL;
+        lyd_xml_ctx_free((struct lyd_ctx *)lydctx);
+        lyd_free_all(*tree_p);
+        *tree_p = NULL;
+    } else {
+        *lydctx_p = (struct lyd_ctx *)lydctx;
     }
     return ret;
 }
@@ -753,7 +688,7 @@
 {
     LY_ERR ret = LY_SUCCESS;
     const struct lyxml_ns *ns = NULL;
-    struct ly_attr *attr = NULL;
+    struct lyd_attr *attr = NULL;
     const char *prefix;
     size_t prefix_len;
 
@@ -795,7 +730,8 @@
     LY_CHECK_GOTO(ret = lyxml_ctx_next(xmlctx), cleanup);
 
     /* create node */
-    ret = lyd_create_opaq(xmlctx->ctx, name, strlen(name), "", 0, NULL, LYD_XML, NULL, prefix, prefix_len, uri, envp);
+    ret = lyd_create_opaq(xmlctx->ctx, name, strlen(name), "", 0, NULL, 0, LYD_XML, NULL, prefix, prefix_len,
+                          uri, strlen(uri), envp);
     LY_CHECK_GOTO(ret, cleanup);
 
     /* assign atributes */
@@ -808,20 +744,17 @@
 }
 
 LY_ERR
-lyd_parse_xml_rpc(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree, struct lyd_node **op)
+lyd_parse_xml_rpc(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **op_p)
 {
     LY_ERR ret = LY_SUCCESS;
     struct lyd_xml_ctx lydctx = {0};
     struct lyd_node *rpc_e = NULL, *act_e = NULL;
+    struct lyd_node *tree = NULL;
 
     /* init */
     LY_CHECK_GOTO(ret = lyxml_ctx_new(ctx, in, &lydctx.xmlctx), cleanup);
-    lydctx.options = LYD_PARSE_ONLY | LYD_PARSE_STRICT;
+    lydctx.parse_options = LYD_PARSE_ONLY | LYD_PARSE_STRICT;
     lydctx.int_opts = LYD_INTOPT_RPC;
-    *tree = NULL;
-    if (op) {
-        *op = NULL;
-    }
 
     /* parse "rpc", if any */
     LY_CHECK_GOTO(ret = lydxml_envelope(lydctx.xmlctx, "rpc", "urn:ietf:params:xml:ns:netconf:base:1.0", &rpc_e), cleanup);
@@ -832,10 +765,10 @@
     }
 
     /* parse the rest of data normally */
-    LY_CHECK_GOTO(ret = lydxml_data_r(&lydctx, NULL, tree), cleanup);
+    LY_CHECK_GOTO(ret = lydxml_data_r(&lydctx, NULL, &tree), cleanup);
 
     /* make sure we have parsed some operation */
-    if (!lydctx.op_ntf) {
+    if (!lydctx.op_node) {
         LOGVAL(ctx, LY_VLOG_NONE, NULL, LYVE_DATA, "Missing the \"rpc\"/\"action\" node.");
         ret = LY_EVALID;
         goto cleanup;
@@ -849,9 +782,9 @@
                    lydctx.xmlctx->name_len, lydctx.xmlctx->name);
             ret = LY_EVALID;
             goto cleanup;
-        } else if (lydctx.op_ntf->schema->nodetype != LYS_ACTION) {
-            LOGVAL(ctx, LY_VLOG_LYD, lydctx.op_ntf, LYVE_DATA, "Unexpected %s element, an \"action\" expected.",
-                   lys_nodetype2str(lydctx.op_ntf->schema->nodetype));
+        } else if (lydctx.op_node->schema->nodetype != LYS_ACTION) {
+            LOGVAL(ctx, LY_VLOG_LYD, lydctx.op_node, LYVE_DATA, "Unexpected %s element, an \"action\" expected.",
+                   lys_nodetype2str(lydctx.op_node->schema->nodetype));
             ret = LY_EVALID;
             goto cleanup;
         }
@@ -864,28 +797,35 @@
                    lydctx.xmlctx->name_len, lydctx.xmlctx->name);
             ret = LY_EVALID;
             goto cleanup;
-        } else if (!act_e && (lydctx.op_ntf->schema->nodetype != LYS_RPC)) {
-            LOGVAL(ctx, LY_VLOG_LYD, lydctx.op_ntf, LYVE_DATA, "Unexpected %s element, an \"rpc\" expected.",
-                   lys_nodetype2str(lydctx.op_ntf->schema->nodetype));
+        } else if (!act_e && (lydctx.op_node->schema->nodetype != LYS_RPC)) {
+            LOGVAL(ctx, LY_VLOG_LYD, lydctx.op_node, LYVE_DATA, "Unexpected %s element, an \"rpc\" expected.",
+                   lys_nodetype2str(lydctx.op_node->schema->nodetype));
             ret = LY_EVALID;
             goto cleanup;
         }
         LY_CHECK_GOTO(ret = lyxml_ctx_next(lydctx.xmlctx), cleanup);
     }
 
-    if (op) {
-        *op = lydctx.op_ntf;
+    if (op_p) {
+        *op_p = lydctx.op_node;
     }
-    assert(*tree);
+    assert(tree);
+    if (tree_p) {
+        *tree_p = tree;
+    }
     if (act_e) {
         /* connect to the action */
-        lyd_insert_node(act_e, NULL, *tree);
-        *tree = act_e;
+        lyd_insert_node(act_e, NULL, *tree_p);
+        if (tree_p) {
+            *tree_p = act_e;
+        }
     }
     if (rpc_e) {
         /* connect to the rpc */
-        lyd_insert_node(rpc_e, NULL, *tree);
-        *tree = rpc_e;
+        lyd_insert_node(rpc_e, NULL, *tree_p);
+        if (tree_p) {
+            *tree_p = rpc_e;
+        }
     }
 
 cleanup:
@@ -893,10 +833,9 @@
     assert(!lydctx.unres_node_type.count && !lydctx.unres_meta_type.count && !lydctx.when_check.count);
     lyxml_ctx_free(lydctx.xmlctx);
     if (ret) {
-        lyd_free_all(*tree);
+        lyd_free_all(tree);
         lyd_free_tree(act_e);
         lyd_free_tree(rpc_e);
-        *tree = NULL;
     }
     return ret;
 }
@@ -906,7 +845,7 @@
 {
     LY_ERR ret = LY_SUCCESS;
     const struct lyxml_ns *ns = NULL;
-    struct ly_attr *attr = NULL;
+    struct lyd_attr *attr = NULL;
     struct lyd_node *et;
     const char *prefix;
     size_t prefix_len;
@@ -961,8 +900,8 @@
     }*/
 
     /* create node */
-    ret = lyd_create_opaq(xmlctx->ctx, "eventTime", 9, xmlctx->value, xmlctx->value_len, NULL, LYD_XML, NULL,
-                          prefix, prefix_len, ns->uri, &et);
+    ret = lyd_create_opaq(xmlctx->ctx, "eventTime", 9, xmlctx->value, xmlctx->value_len, NULL, 0, LYD_XML, NULL,
+                          prefix, prefix_len, ns->uri, strlen(ns->uri), &et);
     LY_CHECK_GOTO(ret, cleanup);
 
     /* assign atributes */
@@ -992,29 +931,26 @@
 }
 
 LY_ERR
-lyd_parse_xml_notif(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree, struct lyd_node **ntf)
+lyd_parse_xml_notif(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **ntf_p)
 {
     LY_ERR ret = LY_SUCCESS;
     struct lyd_xml_ctx lydctx = {0};
     struct lyd_node *ntf_e = NULL;
+    struct lyd_node *tree = NULL;
 
     /* init */
     LY_CHECK_GOTO(ret = lyxml_ctx_new(ctx, in, &lydctx.xmlctx), cleanup);
-    lydctx.options = LYD_PARSE_ONLY | LYD_PARSE_STRICT;
+    lydctx.parse_options = LYD_PARSE_ONLY | LYD_PARSE_STRICT;
     lydctx.int_opts = LYD_INTOPT_NOTIF;
-    *tree = NULL;
-    if (ntf) {
-        *ntf = NULL;
-    }
 
     /* parse "notification" and "eventTime", if present */
     LY_CHECK_GOTO(ret = lydxml_notif_envelope(lydctx.xmlctx, &ntf_e), cleanup);
 
     /* parse the rest of data normally */
-    LY_CHECK_GOTO(ret = lydxml_data_r(&lydctx, NULL, tree), cleanup);
+    LY_CHECK_GOTO(ret = lydxml_data_r(&lydctx, NULL, &tree), cleanup);
 
     /* make sure we have parsed some notification */
-    if (!lydctx.op_ntf) {
+    if (!lydctx.op_node) {
         LOGVAL(ctx, LY_VLOG_NONE, NULL, LYVE_DATA, "Missing the \"notification\" node.");
         ret = LY_EVALID;
         goto cleanup;
@@ -1032,14 +968,19 @@
         LY_CHECK_GOTO(ret = lyxml_ctx_next(lydctx.xmlctx), cleanup);
     }
 
-    if (ntf) {
-        *ntf = lydctx.op_ntf;
+    if (ntf_p) {
+        *ntf_p = lydctx.op_node;
     }
-    assert(*tree);
+    assert(tree);
+    if (tree_p) {
+        *tree_p = tree;
+    }
     if (ntf_e) {
         /* connect to the notification */
-        lyd_insert_node(ntf_e, NULL, *tree);
-        *tree = ntf_e;
+        lyd_insert_node(ntf_e, NULL, *tree_p);
+        if (tree_p) {
+            *tree_p = ntf_e;
+        }
     }
 
 cleanup:
@@ -1047,15 +988,14 @@
     assert(!lydctx.unres_node_type.count && !lydctx.unres_meta_type.count && !lydctx.when_check.count);
     lyxml_ctx_free(lydctx.xmlctx);
     if (ret) {
-        lyd_free_all(*tree);
+        lyd_free_all(tree);
         lyd_free_tree(ntf_e);
-        *tree = NULL;
     }
     return ret;
 }
 
 LY_ERR
-lyd_parse_xml_reply(const struct lyd_node *request, struct ly_in *in, struct lyd_node **tree, struct lyd_node **op)
+lyd_parse_xml_reply(const struct lyd_node *request, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **op_p)
 {
     LY_ERR ret = LY_SUCCESS;
     struct lyd_xml_ctx lydctx = {0};
@@ -1063,12 +1003,8 @@
 
     /* init */
     LY_CHECK_GOTO(ret = lyxml_ctx_new(LYD_NODE_CTX(request), in, &lydctx.xmlctx), cleanup);
-    lydctx.options = LYD_PARSE_ONLY | LYD_PARSE_STRICT;
+    lydctx.parse_options = LYD_PARSE_ONLY | LYD_PARSE_STRICT;
     lydctx.int_opts = LYD_INTOPT_REPLY;
-    *tree = NULL;
-    if (op) {
-        *op = NULL;
-    }
 
     /* find request OP */
     LYD_TREE_DFS_BEGIN((struct lyd_node *)request, req_op) {
@@ -1105,15 +1041,19 @@
         LY_CHECK_GOTO(ret = lyxml_ctx_next(lydctx.xmlctx), cleanup);
     }
 
-    if (op) {
-        *op = rep_op;
+    if (op_p) {
+        *op_p = rep_op;
     }
     for (iter = rep_op; iter->parent; iter = (struct lyd_node *)iter->parent);
-    *tree = iter;
+    if (tree_p) {
+        *tree_p = iter;
+    }
     if (rpcr_e) {
         /* connect to the operation */
-        lyd_insert_node(rpcr_e, NULL, *tree);
-        *tree = rpcr_e;
+        lyd_insert_node(rpcr_e, NULL, *tree_p);
+        if (tree_p) {
+            *tree_p = rpcr_e;
+        }
     }
 
 cleanup:
