data tree FEATURE use hashes of data nodes to be able to compare them effectively
diff --git a/src/parser_xml.c b/src/parser_xml.c
index a6193c0..fcd9681 100644
--- a/src/parser_xml.c
+++ b/src/parser_xml.c
@@ -178,7 +178,10 @@
             }
         }
         attributes = NULL;
-        LY_CHECK_GOTO(lydxml_attributes(ctx, data, &attributes), cleanup);
+        if (ctx->status == LYXML_ATTRIBUTE) {
+            LY_CHECK_GOTO(lydxml_attributes(ctx, data, &attributes), cleanup);
+        }
+
         ns = lyxml_ns_get((struct lyxml_context *)ctx, prefix, prefix_len);
         if (!ns) {
             LOGVAL(ctx->ctx, LY_VLOG_LINE, &ctx->line, LYVE_REFERENCE, "Unknown XML prefix \"%*.s\".", prefix_len, prefix);
@@ -316,6 +319,10 @@
             ((struct lyd_node_any*)cur)->value_type = LYD_ANYDATA_XML;
             ((struct lyd_node_any*)cur)->value.xml = lydict_insert(ctx->ctx, start, stop - start);
         }
+
+        /* calculate the hash and insert it into parent (list with keys is handled when its keys are inserted) */
+        lyd_hash(cur);
+        lyd_insert_hash(cur);
     }
 
 cleanup: