data tree CHANGE use either schema or data node for logging

... depending on whether the data re connected
or not. Tests adjusted accordingly.
diff --git a/src/tree_data.c b/src/tree_data.c
index d22183a..b7e695e 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -70,7 +70,11 @@
     if (ret && (ret != LY_EINCOMPLETE)) {
         if (err) {
             /* node may not be connected yet so use the schema node */
-            LOGVAL(ctx, LY_VLOG_LYSC, node->schema, err->vecode, err->msg);
+            if (!node->parent && lysc_data_parent(node->schema)) {
+                LOGVAL(ctx, LY_VLOG_LYSC, node->schema, err->vecode, err->msg);
+            } else {
+                LOGVAL(ctx, LY_VLOG_LYD, node, err->vecode, err->msg);
+            }
             ly_err_free(err);
         }
         goto error;
diff --git a/tests/utests/data/test_parser_xml.c b/tests/utests/data/test_parser_xml.c
index 0c51134..bda6e7f 100644
--- a/tests/utests/data/test_parser_xml.c
+++ b/tests/utests/data/test_parser_xml.c
@@ -366,7 +366,7 @@
     /* invalid key, no flags */
     data = "<l1 xmlns=\"urn:tests:a\"><a>val_a</a><b>val_b</b><c>val_c</c></l1>";
     assert_int_equal(LY_EVALID, lyd_parse_xml_data(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
-    logbuf_assert("Invalid int16 value \"val_c\". /a:c");
+    logbuf_assert("Invalid int16 value \"val_c\". /a:l1/c");
     assert_null(tree);
 
     /* opaq flag */
diff --git a/tests/utests/data/test_types.c b/tests/utests/data/test_types.c
index 4673257..dc5db56 100644
--- a/tests/utests/data/test_types.c
+++ b/tests/utests/data/test_types.c
@@ -385,7 +385,7 @@
     logbuf_assert("Length \"6\" does not satisfy the length constraint. /types:str-utf8");
     data = "<str-utf8 xmlns=\"urn:tests:types\">€€x</str-utf8>";
     assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
-    logbuf_assert("String \"€€x\" does not conform to the 1. pattern restriction of its type. /types:str-utf8");
+    logbuf_assert("String \"€€x\" does not conform to the pattern \"€*\". /types:str-utf8");
 
     /* invalid length */
     data = "<str xmlns=\"urn:tests:types\">short</str>";
@@ -399,7 +399,7 @@
     /* invalid pattern */
     data = "<str xmlns=\"urn:tests:types\">string15</str>";
     assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
-    logbuf_assert("String \"string15\" does not conform to the 1. pattern restriction of its type. /types:str");
+    logbuf_assert("String \"string15\" does not conform to the pattern \"[a-z ]*\". /types:str");
 
     s->func = NULL;
 }
diff --git a/tests/utests/test_context.c b/tests/utests/test_context.c
index d9b8e9f..fe06f96 100644
--- a/tests/utests/test_context.c
+++ b/tests/utests/test_context.c
@@ -427,7 +427,7 @@
     assert_non_null(ly_ctx_get_module(ctx, "ietf-yang-metadata", "2016-08-05"));
     assert_non_null(ly_ctx_get_module(ctx, "ietf-yang-types", "2013-07-15"));
     assert_non_null(ly_ctx_get_module(ctx, "ietf-inet-types", "2013-07-15"));
-    assert_non_null(ly_ctx_get_module_ns(ctx, "urn:ietf:params:xml:ns:yang:ietf-datastores", "2017-08-17"));
+    assert_non_null(ly_ctx_get_module_ns(ctx, "urn:ietf:params:xml:ns:yang:ietf-datastores", "2018-02-14"));
 
     /* select module by revision */
     mod = lys_parse_mem_module(ctx, str1, LYS_IN_YANG, 1, NULL, NULL);