data tree CHANGE prepare updated validation flags

Except LYD_OPT_VAL_DATA_ONLY, none are implemented, only defined.
Operations (RPC/action/rpc-reply/notification) cannot be parsed
nor validated as they will have a separate function implemented.
Also, mandatory validation implemented.
diff --git a/tests/features/test_nacm.c b/tests/features/test_nacm.c
index 6ae1900..449d163 100644
--- a/tests/features/test_nacm.c
+++ b/tests/features/test_nacm.c
@@ -181,7 +181,7 @@
             "notification notif {nacm:default-deny-write;}}";
     assert_null(lys_parse_mem(s->ctx, data, LYS_IN_YANG));
     logbuf_assert("Extension plugin \"libyang 2 - NACM, version 1\": "
-            "Extension nacm:default-deny-write is not allowed in Notification statement.) /aa:notif/{extension='nacm:default-deny-write'}");
+            "Extension nacm:default-deny-write is not allowed in notification statement.) /aa:notif/{extension='nacm:default-deny-write'}");
 
     data = "module aa {yang-version 1.1; namespace urn:tests:extensions:nacm:aa; prefix en;"
             "import ietf-netconf-acm {revision-date 2018-02-14; prefix nacm;}"
diff --git a/tests/features/test_types.c b/tests/features/test_types.c
index 5d508d9..751f78a 100644
--- a/tests/features/test_types.c
+++ b/tests/features/test_types.c
@@ -155,7 +155,7 @@
     const char *data = "<int8 xmlns=\"urn:tests:types\">\n 15 \t\n  </int8>";
 
     /* valid data */
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("int8", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -172,28 +172,28 @@
 
     /* invalid range */
     data = "<int8 xmlns=\"urn:tests:types\">1</int8>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Value \"1\" does not satisfy the range constraint. /");
 
     data = "<int16 xmlns=\"urn:tests:types\">100</int16>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Value \"100\" does not satisfy the range constraint. /");
 
     /* invalid value */
     data = "<int32 xmlns=\"urn:tests:types\">0x01</int32>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid int32 value \"0x01\". /");
 
     data = "<int64 xmlns=\"urn:tests:types\"></int64>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid empty int64 value. /");
 
     data = "<int64 xmlns=\"urn:tests:types\">   </int64>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid empty int64 value. /");
 
     data = "<int64 xmlns=\"urn:tests:types\">-10  xxx</int64>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid int64 value \"-10  xxx\". /");
 
     s->func = NULL;
@@ -212,7 +212,7 @@
     const char *data = "<uint8 xmlns=\"urn:tests:types\">\n 150 \t\n  </uint8>";
 
     /* valid data */
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("uint8", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -229,28 +229,28 @@
 
     /* invalid range */
     data = "<uint8 xmlns=\"urn:tests:types\">\n 15 \t\n  </uint8>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Value \"15\" does not satisfy the range constraint. /");
 
     data = "<uint16 xmlns=\"urn:tests:types\">\n 1500 \t\n  </uint16>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Value \"1500\" does not satisfy the range constraint. /");
 
     /* invalid value */
     data = "<uint32 xmlns=\"urn:tests:types\">-10</uint32>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Value \"-10\" is out of uint32's min/max bounds. /");
 
     data = "<uint64 xmlns=\"urn:tests:types\"/>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid empty uint64 value. /");
 
     data = "<uint64 xmlns=\"urn:tests:types\">   </uint64>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid empty uint64 value. /");
 
     data = "<uint64 xmlns=\"urn:tests:types\">10  xxx</uint64>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid uint64 value \"10  xxx\". /");
 
     s->func = NULL;
@@ -269,7 +269,7 @@
     const char *data = "<dec64 xmlns=\"urn:tests:types\">\n +8 \t\n  </dec64>";
 
     /* valid data */
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("dec64", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -285,7 +285,7 @@
     lyd_free_all(tree);
 
     data = "<dec64 xmlns=\"urn:tests:types\">8.00</dec64>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("dec64", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -294,7 +294,7 @@
     lyd_free_all(tree);
 
     data = "<dec64-norestr xmlns=\"urn:tests:types\">-9.223372036854775808</dec64-norestr>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("dec64-norestr", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -303,7 +303,7 @@
     lyd_free_all(tree);
 
     data = "<dec64-norestr xmlns=\"urn:tests:types\">9.223372036854775807</dec64-norestr>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("dec64-norestr", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -313,32 +313,32 @@
 
     /* invalid range */
     data = "<dec64 xmlns=\"urn:tests:types\">\n 15 \t\n  </dec64>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Value \"15.0\" does not satisfy the range constraint. /");
 
     data = "<dec64 xmlns=\"urn:tests:types\">\n 0 \t\n  </dec64>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Value \"0.0\" does not satisfy the range constraint. /");
 
     /* invalid value */
     data = "<dec64 xmlns=\"urn:tests:types\">xxx</dec64>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid 1. character of decimal64 value \"xxx\". /");
 
     data = "<dec64 xmlns=\"urn:tests:types\"/>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid empty decimal64 value. /");
 
     data = "<dec64 xmlns=\"urn:tests:types\">   </dec64>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid empty decimal64 value. /");
 
     data = "<dec64 xmlns=\"urn:tests:types\">8.5  xxx</dec64>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid 6. character of decimal64 value \"8.5  xxx\". /");
 
     data = "<dec64 xmlns=\"urn:tests:types\">8.55  xxx</dec64>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Value \"8.55\" of decimal64 type exceeds defined number (1) of fraction digits. /");
 
     s->func = NULL;
@@ -356,7 +356,7 @@
     const char *data = "<str xmlns=\"urn:tests:types\">teststring</str>";
 
     /* valid data */
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("str", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -365,34 +365,34 @@
 
     /* multibyte characters (€ encodes as 3-byte UTF8 character, length restriction is 2-5) */
     data = "<str-utf8 xmlns=\"urn:tests:types\">€€</str-utf8>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("str-utf8", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
     assert_string_equal("€€", leaf->value.canonical_cache);
     lyd_free_all(tree);
     data = "<str-utf8 xmlns=\"urn:tests:types\">€</str-utf8>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Length \"1\" does not satisfy the length constraint. /");
     data = "<str-utf8 xmlns=\"urn:tests:types\">€€€€€€</str-utf8>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Length \"6\" does not satisfy the length constraint. /");
     data = "<str-utf8 xmlns=\"urn:tests:types\">€€x</str-utf8>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("String \"€€x\" does not conform to the 1. pattern restriction of its type. /");
 
     /* invalid length */
     data = "<str xmlns=\"urn:tests:types\">short</str>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Length \"5\" does not satisfy the length constraint. /");
 
     data = "<str xmlns=\"urn:tests:types\">tooooo long</str>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Length \"11\" does not satisfy the length constraint. /");
 
     /* invalid pattern */
     data = "<str xmlns=\"urn:tests:types\">string15</str>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("String \"string15\" does not conform to the 1. pattern restriction of its type. /");
 
     s->func = NULL;
@@ -411,7 +411,7 @@
     const char *data = "<bits xmlns=\"urn:tests:types\">\n two    \t\nzero\n  </bits>";
 
     /* valid data */
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("bits", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -431,7 +431,7 @@
     lyd_free_all(tree);
 
     data = "<bits xmlns=\"urn:tests:types\">zero  two</bits>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("bits", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -440,12 +440,12 @@
 
     /* disabled feature */
     data = "<bits xmlns=\"urn:tests:types\"> \t one \n\t </bits>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Bit \"one\" is disabled by its 1. if-feature condition. /");
 
     /* enable that feature */
     assert_int_equal(LY_SUCCESS, lys_feature_enable(ly_ctx_get_module(s->ctx, "types", NULL), "f"));
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("bits", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -463,12 +463,12 @@
 
     /* multiple instances of the bit */
     data = "<bits xmlns=\"urn:tests:types\">one zero one</bits>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Bit \"one\" used multiple times. /");
 
     /* invalid bit value */
     data = "<bits xmlns=\"urn:tests:types\">one xero one</bits>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid bit value \"xero\". /");
 
     s->func = NULL;
@@ -487,7 +487,7 @@
     const char *data = "<enums xmlns=\"urn:tests:types\">white</enums>";
 
     /* valid data */
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("enums", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -503,12 +503,12 @@
 
     /* disabled feature */
     data = "<enums xmlns=\"urn:tests:types\">yellow</enums>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Enumeration \"yellow\" is disabled by its 1. if-feature condition. /");
 
     /* enable that feature */
     assert_int_equal(LY_SUCCESS, lys_feature_enable(ly_ctx_get_module(s->ctx, "types", NULL), "f"));
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("enums", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -517,15 +517,15 @@
 
     /* leading/trailing whitespaces are not valid */
     data = "<enums xmlns=\"urn:tests:types\"> white</enums>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid enumeration value \" white\". /");
     data = "<enums xmlns=\"urn:tests:types\">white\n</enums>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid enumeration value \"white\n\". /");
 
     /* invalid enumeration value */
     data = "<enums xmlns=\"urn:tests:types\">black</enums>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid enumeration value \"black\". /");
 
     s->func = NULL;
@@ -545,7 +545,7 @@
                        "<binary-norestr xmlns=\"urn:tests:types\">TQ==</binary-norestr>";
 
     /* valid data (hello) */
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("binary", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -565,21 +565,21 @@
 
     /* no data */
     data = "<binary-norestr xmlns=\"urn:tests:types\">\n    \t\n  </binary-norestr>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("binary-norestr", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
     assert_string_equal("", leaf->value.canonical_cache);
     lyd_free_all(tree);
     data = "<binary-norestr xmlns=\"urn:tests:types\"></binary-norestr>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("binary-norestr", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
     assert_string_equal("", leaf->value.canonical_cache);
     lyd_free_all(tree);
     data = "<binary-norestr xmlns=\"urn:tests:types\"/>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("binary-norestr", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -588,23 +588,23 @@
 
     /* invalid base64 character */
     data = "<binary-norestr xmlns=\"urn:tests:types\">a@bcd=</binary-norestr>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid Base64 character (@). /");
 
     /* missing data */
     data = "<binary-norestr xmlns=\"urn:tests:types\">aGVsbG8</binary-norestr>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Base64 encoded value length must be divisible by 4. /");
     data = "<binary-norestr xmlns=\"urn:tests:types\">VsbG8=</binary-norestr>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Base64 encoded value length must be divisible by 4. /");
 
     /* invalid binary length */
     data = "<binary xmlns=\"urn:tests:types\">aGVsbG93b3JsZA==</binary>"; /* helloworld */
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("This base64 value must be of length 5. /");
     data = "<binary xmlns=\"urn:tests:types\">TQ==</binary>"; /* M */
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("This base64 value must be of length 5. /");
 
     s->func = NULL;
@@ -622,7 +622,7 @@
     const char *data = "<bool xmlns=\"urn:tests:types\">true</bool>";
 
     /* valid data */
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("bool", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -631,7 +631,7 @@
     lyd_free_all(tree);
 
     data = "<bool xmlns=\"urn:tests:types\">false</bool>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("bool", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -641,11 +641,11 @@
 
     /* invalid value */
     data = "<bool xmlns=\"urn:tests:types\">unsure</bool>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid boolean value \"unsure\". /");
 
     data = "<bool xmlns=\"urn:tests:types\"> true</bool>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid boolean value \" true\". /");
 
     s->func = NULL;
@@ -663,7 +663,7 @@
     const char *data = "<empty xmlns=\"urn:tests:types\"></empty>";
 
     /* valid data */
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("empty", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -671,7 +671,7 @@
     lyd_free_all(tree);
 
     data = "<empty xmlns=\"urn:tests:types\"/>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("empty", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -680,11 +680,11 @@
 
     /* invalid value */
     data = "<empty xmlns=\"urn:tests:types\">x</empty>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid empty value \"x\". /");
 
     data = "<empty xmlns=\"urn:tests:types\"> </empty>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid empty value \" \". /");
 
     s->func = NULL;
@@ -723,7 +723,7 @@
     const char *data = "<ident xmlns=\"urn:tests:types\">gigabit-ethernet</ident>";
 
     /* valid data */
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("ident", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -739,7 +739,7 @@
     lyd_free_all(tree);
 
     data = "<ident xmlns=\"urn:tests:types\" xmlns:x=\"urn:tests:defs\">x:fast-ethernet</ident>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("ident", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -749,19 +749,19 @@
 
     /* invalid value */
     data = "<ident xmlns=\"urn:tests:types\">fast-ethernet</ident>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid identityref \"fast-ethernet\" value - identity not found. /");
 
     data = "<ident xmlns=\"urn:tests:types\" xmlns:x=\"urn:tests:defs\">x:slow-ethernet</ident>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid identityref \"x:slow-ethernet\" value - identity not found. /");
 
     data = "<ident xmlns=\"urn:tests:types\" xmlns:x=\"urn:tests:defs\">x:crypto-alg</ident>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid identityref \"x:crypto-alg\" value - identity not accepted by the type specification. /");
 
     data = "<ident xmlns=\"urn:tests:types\" xmlns:x=\"urn:tests:unknown\">x:fast-ethernet</ident>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid identityref \"x:fast-ethernet\" value - unable to map prefix to YANG schema. /");
 
     s->func = NULL;
@@ -793,7 +793,7 @@
             "<xdf:inst xmlns:xdf=\"urn:tests:types\">/xdf:cont/xdf:leaftarget</xdf:inst>";
 
     /* valid data */
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     tree = tree->prev;
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("inst", tree->schema->name);
@@ -818,7 +818,7 @@
 
     data = "<list xmlns=\"urn:tests:types\"><id>a</id></list><list xmlns=\"urn:tests:types\"><id>b</id></list>"
            "<xdf:inst xmlns:xdf=\"urn:tests:types\">/xdf:list[xdf:id='b']/xdf:id</xdf:inst>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     tree = tree->prev;
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("inst", tree->schema->name);
@@ -828,7 +828,7 @@
 
     data = "<leaflisttarget xmlns=\"urn:tests:types\">1</leaflisttarget><leaflisttarget xmlns=\"urn:tests:types\">2</leaflisttarget>"
            "<xdf:inst xmlns:xdf=\"urn:tests:types\">/xdf:leaflisttarget[.='1']</xdf:inst>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     tree = tree->prev;
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("inst", tree->schema->name);
@@ -838,7 +838,7 @@
 
     data = "<list xmlns=\"urn:tests:types\"><id>a</id></list><list xmlns=\"urn:tests:types\"><id>b</id><value>x</value></list>"
            "<xdf:inst xmlns:xdf=\"urn:tests:types\">/xdf:list[2]/xdf:value</xdf:inst>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     tree = tree->prev;
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("inst", tree->schema->name);
@@ -850,7 +850,7 @@
            "<list_inst xmlns=\"urn:tests:types\"><id xmlns:b=\"urn:tests:types\">/b:leaflisttarget[.='b']</id><value>y</value></list_inst>"
            "<leaflisttarget xmlns=\"urn:tests:types\">a</leaflisttarget><leaflisttarget xmlns=\"urn:tests:types\">b</leaflisttarget>"
            "<a:inst xmlns:a=\"urn:tests:types\">/a:list_inst[a:id=\"/a:leaflisttarget[.='b']\"]/a:value</a:inst>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     tree = tree->prev;
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("inst", tree->schema->name);
@@ -880,7 +880,7 @@
            "<list_inst xmlns=\"urn:tests:types\"><id xmlns:b=\"urn:tests:types\">/b:leaflisttarget[2]</id><value>y</value></list_inst>"
            "<leaflisttarget xmlns=\"urn:tests:types\">a</leaflisttarget><leaflisttarget xmlns=\"urn:tests:types\">b</leaflisttarget>"
            "<a:inst xmlns:a=\"urn:tests:types\">/a:list_inst[a:id=\"/a:leaflisttarget[2]\"]/a:value</a:inst>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     tree = tree->prev;
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("inst", tree->schema->name);
@@ -891,7 +891,7 @@
     data = "<list_ident xmlns=\"urn:tests:types\"><id xmlns:dfs=\"urn:tests:defs\">dfs:ethernet</id><value>x</value></list_ident>"
            "<list_ident xmlns=\"urn:tests:types\"><id xmlns:dfs=\"urn:tests:defs\">dfs:fast-ethernet</id><value>y</value></list_ident>"
            "<a:inst xmlns:a=\"urn:tests:types\" xmlns:d=\"urn:tests:defs\">/a:list_ident[a:id='d:fast-ethernet']/a:value</a:inst>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     tree = tree->prev;
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("inst", tree->schema->name);
@@ -902,7 +902,7 @@
     data = "<list2 xmlns=\"urn:tests:types\"><id>types:xxx</id><value>x</value></list2>"
            "<list2 xmlns=\"urn:tests:types\"><id>a:xxx</id><value>y</value></list2>"
            "<a:inst xmlns:a=\"urn:tests:types\">/a:list2[a:id='a:xxx'][a:value='y']/a:value</a:inst>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     tree = tree->prev;
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("inst", tree->schema->name);
@@ -913,7 +913,7 @@
     data = "<list xmlns=\"urn:tests:types\"><id>types:xxx</id><value>x</value></list>"
            "<list xmlns=\"urn:tests:types\"><id>a:xxx</id><value>y</value></list>"
            "<a:inst xmlns:a=\"urn:tests:types\">/a:list[2]/a:value</a:inst>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     tree = tree->prev;
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("inst", tree->schema->name);
@@ -925,7 +925,7 @@
            "<list2 xmlns=\"urn:tests:types\"><id>c</id><value>b</value></list2>"
            "<list2 xmlns=\"urn:tests:types\"><id>a</id><value>b</value></list2>"
            "<a:inst xmlns:a=\"urn:tests:types\">/a:list2[a:id='a'][a:value='b']/a:id</a:inst>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     tree = tree->prev;
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("inst", tree->schema->name);
@@ -939,136 +939,136 @@
 
     /* invalid value */
     data =  "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:1leaftarget</t:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/t:cont/t:1leaftarget\" value at character 11 (1leaftarget). /");
 
     data =  "<t:inst xmlns:t=\"urn:tests:types\">/t:cont:t:1leaftarget</t:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/t:cont:t:1leaftarget\" value at character 8 (:t:1leaftarget). /");
 
     data =  "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:invalid/t:path</t:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/t:cont/t:invalid/t:path\" value - path \"/t:cont/t:invalid\" does not exists in the YANG schema. /");
 
     data =  "<inst xmlns=\"urn:tests:types\" xmlns:t=\"urn:tests:invalid\">/t:cont/t:leaftarget</inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/t:cont/t:leaftarget\" value - unable to map prefix \"t\" to YANG schema. /");
 
     data =  "<inst xmlns=\"urn:tests:types\">/cont/leaftarget</inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/cont/leaftarget\" value - all node names (/cont) MUST be qualified with explicit namespace prefix. /");
 
     data =  "<cont xmlns=\"urn:tests:types\"/><t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaftarget</t:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     /* instance-identifier is here in JSON format because it is already in internal representation without original prefixes */
     logbuf_assert("Invalid instance-identifier \"/types:cont/leaftarget\" value - required instance not found. /");
 
     data =  "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaftarget</t:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     /* instance-identifier is here in JSON format because it is already in internal representation without original prefixes */
     logbuf_assert("Invalid instance-identifier \"/types:cont/leaftarget\" value - required instance not found. /");
 
     data =  "<leaflisttarget xmlns=\"urn:tests:types\">x</leaflisttarget><t:inst xmlns:t=\"urn:tests:types\">/t:leaflisttarget[1</t:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/t:leaflisttarget[1\" value's predicate \"[1\" (Predicate (pos) is not terminated by ']' character.). /");
 
     data =  "<cont xmlns=\"urn:tests:types\"/><t:inst xmlns:t=\"urn:tests:types\">/t:cont[1]</t:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/t:cont[1]\" value - predicate \"[1]\" for container is not accepted. /");
 
     data =  "<cont xmlns=\"urn:tests:types\"/><t:inst xmlns:t=\"urn:tests:types\">[1]</t:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"[1]\" value - instance-identifier must starts with '/'. /");
 
     data =  "<cont xmlns=\"urn:tests:types\"><leaflisttarget>1</leaflisttarget></cont><t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaflisttarget[id='1']</t:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/t:cont/t:leaflisttarget[id='1']\" value's predicate \"[id=\" (Missing prefix of a node name.). /");
 
     data =  "<cont xmlns=\"urn:tests:types\"><leaflisttarget>1</leaflisttarget></cont><t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaflisttarget[t:id='1']</t:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/t:cont/t:leaflisttarget[t:id='1']\" value - key-predicate \"[t:id='1']\" is accepted only for lists, not leaf-list. /");
 
     data =  "<cont xmlns=\"urn:tests:types\"><leaflisttarget>1</leaflisttarget><leaflisttarget>2</leaflisttarget></cont>"
             "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaflisttarget[4]</t:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     /* instance-identifier is here in JSON format because it is already in internal representation without original prefixes */
     logbuf_assert("Invalid instance-identifier \"/types:cont/leaflisttarget[4]\" value - required instance not found. /");
 
     data =  "<t:inst-noreq xmlns:t=\"urn:tests:types\">/t:cont/t:leaflisttarget[6]</t:inst-noreq>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/t:cont/t:leaflisttarget[6]\" value - "
             "position-predicate 6 is bigger than allowed max-elements (5). /");
 
     data =  "<cont xmlns=\"urn:tests:types\"><listtarget><id>1</id><value>x</value></listtarget></cont>"
             "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[t:value='x']</t:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/t:cont/t:listtarget[t:value='x']\" value - "
             "node \"value\" used in key-predicate \"[t:value='x']\" must be a key. /");
     logbuf_clean();
     data =  "<t:inst-noreq xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[t:value='x']</t:inst-noreq>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/t:cont/t:listtarget[t:value='x']\" value - "
             "node \"value\" used in key-predicate \"[t:value='x']\" must be a key. /");
     data =  "<t:inst-noreq xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[t:x='x']</t:inst-noreq>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/t:cont/t:listtarget[t:x='x']\" value - "
             "path \"/t:cont/t:listtarget[t:x\" does not exists in the YANG schema. /");
 
     data =  "<cont xmlns=\"urn:tests:types\"><listtarget><id>1</id><value>x</value></listtarget></cont>"
             "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[.='x']</t:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/t:cont/t:listtarget[.='x']\" value - "
             "leaf-list-predicate \"[.='x']\" is accepted only for leaf-lists, not list. /");
 
     data =  "<cont xmlns=\"urn:tests:types\"><leaflisttarget>1</leaflisttarget></cont>"
             "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaflisttarget[.='2']</t:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     /* instance-identifier is here in JSON format because it is already in internal representation without original prefixes */
     logbuf_assert("Invalid instance-identifier \"/types:cont/leaflisttarget[.='2']\" value - required instance not found. /");
 
     data =  "<cont xmlns=\"urn:tests:types\"><leaflisttarget>1</leaflisttarget></cont>"
             "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaflisttarget[.='x']</t:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/t:cont/t:leaflisttarget[.='x']\" value - "
             "leaf-list-predicate \"[.='x']\"'s value is invalid. /");
 
     data =  "<cont xmlns=\"urn:tests:types\"><listtarget><id>1</id><value>x</value></listtarget></cont>"
             "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[t:id='x']</t:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/t:cont/t:listtarget[t:id='x']\" value - "
             "key-predicate \"[t:id='x']\"'s key value is invalid. /");
 
     data =  "<cont xmlns=\"urn:tests:types\"><listtarget><id>1</id><value>x</value></listtarget></cont>"
             "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[t:id='2']</t:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     /* instance-identifier is here in JSON format because it is already in internal representation without original prefixes */
     logbuf_assert("Invalid instance-identifier \"/types:cont/listtarget[id='2']\" value - required instance not found. /");
 
     data = "<leaflisttarget xmlns=\"urn:tests:types\">a</leaflisttarget>"
            "<leaflisttarget xmlns=\"urn:tests:types\">b</leaflisttarget>"
            "<a:inst xmlns:a=\"urn:tests:types\">/a:leaflisttarget[1][2]</a:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/a:leaflisttarget[1][2]\" value - "
             "position predicate (\"[2]\") cannot be used repeatedly for a single node. /");
 
     data = "<leaflisttarget xmlns=\"urn:tests:types\">a</leaflisttarget>"
            "<leaflisttarget xmlns=\"urn:tests:types\">b</leaflisttarget>"
            "<a:inst xmlns:a=\"urn:tests:types\">/a:leaflisttarget[.='a'][.='b']</a:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/a:leaflisttarget[.='a'][.='b']\" value - "
             "leaf-list-predicate (\"[.='b']\") cannot be used repeatedly for a single node. /");
 
     data = "<list xmlns=\"urn:tests:types\"><id>a</id><value>x</value></list>"
            "<list xmlns=\"urn:tests:types\"><id>b</id><value>y</value></list>"
            "<a:inst xmlns:a=\"urn:tests:types\">/a:list[a:id='a'][a:id='b']/a:value</a:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/a:list[a:id='a'][a:id='b']/a:value\" value - "
                   "key \"id\" is referenced the second time in key-predicate \"[a:id='b']\". /");
 
     data = "<list2 xmlns=\"urn:tests:types\"><id>a</id><value>x</value></list2>"
            "<list2 xmlns=\"urn:tests:types\"><id>b</id><value>y</value></list2>"
            "<a:inst xmlns:a=\"urn:tests:types\">/a:list2[a:id='a']/a:value</a:inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/a:list2[a:id='a']/a:value\" value - "
                   "missing 1 key(s) for the list instance \"a:list2[a:id='a']\". /");
 
@@ -1078,7 +1078,7 @@
            "<leaflisttarget xmlns=\"urn:tests:types\">a</leaflisttarget>"
            "<leaflisttarget xmlns=\"urn:tests:types\">b</leaflisttarget>"
            "<a:inst xmlns:a=\"urn:tests:types\">/a:list2[a:id='a'][a:value='a']/a:id</a:inst>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     trees = lyd_trees_new(1, tree);
     /* key-predicate */
     data = "/a:list2[a:id='a'][a:value='b']/a:id";
@@ -1102,7 +1102,7 @@
 
     data = "<leaflisttarget xmlns=\"urn:tests:types\">b</leaflisttarget>"
            "<inst xmlns=\"urn:tests:types\">/a:leaflisttarget[1]</inst>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid instance-identifier \"/a:leaflisttarget[1]\" value - unable to map prefix \"a\" to YANG schema. /");
 
     s->func = NULL;
@@ -1134,7 +1134,7 @@
     assert_non_null(lys_parse_mem(s->ctx, schema, LYS_IN_YANG));
 
     /* valid data */
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     tree = tree->prev;
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("lref", tree->schema->name);
@@ -1146,7 +1146,7 @@
     data = "<list xmlns=\"urn:tests:types\"><id>x</id><targets>a</targets><targets>b</targets></list>"
            "<list xmlns=\"urn:tests:types\"><id>y</id><targets>x</targets><targets>y</targets></list>"
            "<str-norestr xmlns=\"urn:tests:types\">y</str-norestr><lref2 xmlns=\"urn:tests:types\">y</lref2>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     tree = tree->prev;
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("lref2", tree->schema->name);
@@ -1156,7 +1156,7 @@
 
     data = "<str-norestr xmlns=\"urn:tests:types\">y</str-norestr>"
            "<c xmlns=\"urn:tests:leafrefs\"><l><id>x</id><value>x</value><lr1>y</lr1></l></c>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     tree = tree->prev;
     assert_int_equal(LYS_CONTAINER, tree->schema->nodetype);
     leaf = (struct lyd_node_term*)(lyd_node_children(lyd_node_children(tree))->prev);
@@ -1168,7 +1168,7 @@
     data = "<str-norestr xmlns=\"urn:tests:types\">y</str-norestr>"
            "<c xmlns=\"urn:tests:leafrefs\"><l><id>y</id><value>y</value></l>"
               "<l><id>x</id><value>x</value><lr2>y</lr2></l></c>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     tree = tree->prev;
     assert_int_equal(LYS_CONTAINER, tree->schema->nodetype);
     leaf = (struct lyd_node_term*)(lyd_node_children(lyd_node_children(tree)->prev)->prev);
@@ -1181,7 +1181,7 @@
            "<list xmlns=\"urn:tests:types\"><id>y</id><targets>c</targets><targets>d</targets></list>"
            "<c xmlns=\"urn:tests:leafrefs\"><x><x>y</x></x>"
               "<l><id>x</id><value>x</value><lr3>c</lr3></l></c>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     tree = tree->prev;
     assert_int_equal(LYS_CONTAINER, tree->schema->nodetype);
     leaf = (struct lyd_node_term*)(lyd_node_children(lyd_node_children(tree)->prev)->prev);
@@ -1193,34 +1193,34 @@
     /* invalid value */
     data =  "<leaflisttarget xmlns=\"urn:tests:types\">x</leaflisttarget>"
             "<lref xmlns=\"urn:tests:types\">y</lref>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid leafref value \"y\" - required instance \"/leaflisttarget\" with this value does not exists in the data tree(s). /");
 
     data = "<list xmlns=\"urn:tests:types\"><id>x</id><targets>a</targets><targets>b</targets></list>"
            "<list xmlns=\"urn:tests:types\"><id>y</id><targets>x</targets><targets>y</targets></list>"
            "<str-norestr xmlns=\"urn:tests:types\">y</str-norestr><lref2 xmlns=\"urn:tests:types\">b</lref2>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid leafref value \"b\" - required instance \"../list[id = current()/../str-norestr]/targets\" with this value does not exists in the data tree(s). /");
 
     data = "<list xmlns=\"urn:tests:types\"><id>x</id><targets>a</targets><targets>b</targets></list>"
            "<list xmlns=\"urn:tests:types\"><id>y</id><targets>x</targets><targets>y</targets></list>"
            "<lref2 xmlns=\"urn:tests:types\">b</lref2>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid leafref - required instance \"../list[id = current()/../str-norestr]\" does not exists in the data tree(s). /");
 
     data = "<str-norestr xmlns=\"urn:tests:types\">y</str-norestr><lref2 xmlns=\"urn:tests:types\">b</lref2>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid leafref - required instance \"../list\" does not exists in the data tree(s). /");
 
     data = "<str-norestr xmlns=\"urn:tests:types\">y</str-norestr>"
             "<c xmlns=\"urn:tests:leafrefs\"><l><id>x</id><value>x</value><lr1>a</lr1></l></c>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid leafref value \"a\" - required instance \"../../../t:str-norestr\" with this value does not exists in the data tree(s). /");
 
     data = "<str-norestr xmlns=\"urn:tests:types\">z</str-norestr>"
             "<c xmlns=\"urn:tests:leafrefs\"><l><id>y</id><value>y</value></l>"
               "<l><id>x</id><value>x</value><lr2>z</lr2></l></c>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid leafref - required instance \"../../l[id=current()/../../../t:str-norestr][value=current()/../../../t:str-norestr]\" "
                   "does not exists in the data tree(s). /");
 
@@ -1253,7 +1253,7 @@
             "<un1 xmlns=\"urn:tests:types\">12</un1>";
 
     /* valid data */
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     tree = tree->prev;
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("un1", tree->schema->name);
@@ -1281,7 +1281,7 @@
 
     data = "<int8 xmlns=\"urn:tests:types\">11</int8><int8 xmlns=\"urn:tests:types\">12</int8>"
            "<un1 xmlns=\"urn:tests:types\">2</un1>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     tree = tree->prev;
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("un1", tree->schema->name);
@@ -1295,7 +1295,7 @@
     lyd_free_all(tree);
 
     data = "<un1 xmlns=\"urn:tests:types\" xmlns:x=\"urn:tests:defs\">x:fast-ethernet</un1>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("un1", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -1321,7 +1321,7 @@
     lyd_free_all(tree);
 
     data = "<un1 xmlns=\"urn:tests:types\" xmlns:d=\"urn:tests:defs\">d:superfast-ethernet</un1>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("un1", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
@@ -1335,7 +1335,7 @@
 
     data = "<leaflisttarget xmlns=\"urn:tests:types\">x</leaflisttarget><leaflisttarget xmlns=\"urn:tests:types\">y</leaflisttarget>"
            "<un1 xmlns=\"urn:tests:types\" xmlns:a=\"urn:tests:types\">/a:leaflisttarget[2]</un1>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     tree = tree->prev;
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("un1", tree->schema->name);
@@ -1350,7 +1350,7 @@
 
     data = "<leaflisttarget xmlns=\"urn:tests:types\">x</leaflisttarget><leaflisttarget xmlns=\"urn:tests:types\">y</leaflisttarget>"
            "<un1 xmlns=\"urn:tests:types\" xmlns:a=\"urn:tests:types\">/a:leaflisttarget[3]</un1>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     tree = tree->prev;
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("un1", tree->schema->name);
@@ -1364,7 +1364,7 @@
     lyd_free_all(tree);
 
     data = "<un1 xmlns=\"urn:tests:types\">123456789012345678901</un1>";
-    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, 0, NULL));
+    assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     logbuf_assert("Invalid union value \"123456789012345678901\" - no matching subtype found. /");
 
     s->func = NULL;
diff --git a/tests/src/test_parser_xml.c b/tests/src/test_parser_xml.c
index f5c7d31..dcdf84a 100644
--- a/tests/src/test_parser_xml.c
+++ b/tests/src/test_parser_xml.c
@@ -110,7 +110,7 @@
     struct lyd_node *tree;
     struct lyd_node_term *leaf;
 
-    assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, 0, NULL, &tree));
+    assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
     assert_non_null(tree);
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("foo", tree->schema->name);
@@ -132,7 +132,7 @@
     struct lyd_node *tree;
     struct lyd_node_any *any;
 
-    assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, 0, NULL, &tree));
+    assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
     assert_non_null(tree);
     assert_int_equal(LYS_ANYDATA, tree->schema->nodetype);
     assert_string_equal("any", tree->schema->name);
@@ -155,7 +155,7 @@
     struct lyd_node_term *leaf;
 
     /* check hashes */
-    assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, 0, NULL, &tree));
+    assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
     assert_non_null(tree);
     assert_int_equal(LYS_LIST, tree->schema->nodetype);
     assert_string_equal("l1", tree->schema->name);
@@ -167,7 +167,7 @@
 
     /* keys order */
     data = "<l1 xmlns=\"urn:tests:a\"><d>d</d><a>a</a><c>c</c><b>b</b></l1>";
-    assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, 0, NULL, &tree));
+    assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
     assert_non_null(tree);
     assert_int_equal(LYS_LIST, tree->schema->nodetype);
     assert_string_equal("l1", tree->schema->name);
@@ -184,7 +184,7 @@
     lyd_free_all(tree);
 
     data = "<l1 xmlns=\"urn:tests:a\"><c>c</c><b>b</b><a>a</a></l1>";
-    assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, 0, NULL, &tree));
+    assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
     assert_non_null(tree);
     assert_int_equal(LYS_LIST, tree->schema->nodetype);
     assert_string_equal("l1", tree->schema->name);
@@ -199,11 +199,11 @@
     logbuf_clean();
     lyd_free_all(tree);
 
-    assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_OPT_STRICT, NULL, &tree));
+    assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_OPT_STRICT, &tree));
     logbuf_assert("Invalid position of the key \"b\" in a list. Line number 1.");
 /* TODO validation
     data = "<l1 xmlns=\"urn:tests:a\"><a>a</a><c>c</c><d>d</d></l1>";
-    assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_OPT_STRICT, NULL, &tree));
+    assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_OPT_STRICT, &tree));
     logbuf_assert("Missing key \"b\" in a list. Line number 1.");
 */
 
@@ -219,7 +219,7 @@
     struct lyd_node *tree;
     struct lyd_node_inner *cont;
 
-    assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, 0, NULL, &tree));
+    assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
     assert_non_null(tree);
     assert_int_equal(LYS_CONTAINER, tree->schema->nodetype);
     assert_string_equal("c", tree->schema->name);
@@ -228,7 +228,7 @@
     lyd_free_all(tree);
 
     data = "<cp xmlns=\"urn:tests:a\"/>";
-    assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, 0, NULL, &tree));
+    assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
     assert_non_null(tree);
     assert_int_equal(LYS_CONTAINER, tree->schema->nodetype);
     assert_string_equal("cp", tree->schema->name);
diff --git a/tests/src/test_printer_xml.c b/tests/src/test_printer_xml.c
index 942f5b9..2c815d1 100644
--- a/tests/src/test_printer_xml.c
+++ b/tests/src/test_printer_xml.c
@@ -159,7 +159,7 @@
 
     data = "<int8 xmlns=\"urn:tests:types\">\n 15 \t\n  </int8>";
     result = "<int8 xmlns=\"urn:tests:types\">15</int8>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_true((len = lyd_print_mem(&printed, tree, LYD_XML, 0)) >= 0);
     assert_int_equal(len, strlen(printed));
     assert_string_equal(printed, result);
@@ -181,7 +181,7 @@
     s->func = test_anydata;
 
     data = "<any xmlns=\"urn:tests:types\"><somexml xmlns:x=\"url:x\" xmlns=\"example.com\"><x:x/></somexml></any>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_true((len = lyd_print_mem(&printed, tree, LYD_XML, 0)) >= 0);
     assert_int_equal(len, strlen(printed));
     assert_string_equal(printed, data);
@@ -189,7 +189,7 @@
     lyd_free_all(tree);
 
     data = "<any xmlns=\"urn:tests:types\"/>";
-    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_true((len = lyd_print_mem(&printed, tree, LYD_XML, 0)) >= 0);
     assert_int_equal(len, strlen(printed));
     assert_string_equal(printed, data);
@@ -199,6 +199,8 @@
     s->func = NULL;
 }
 
+#if 0
+
 static void
 test_rpc(void **state)
 {
@@ -277,12 +279,13 @@
     s->func = NULL;
 }
 
+#endif
+
 int main(void)
 {
     const struct CMUnitTest tests[] = {
         cmocka_unit_test_setup_teardown(test_leaf, setup, teardown),
         cmocka_unit_test_setup_teardown(test_anydata, setup, teardown),
-        cmocka_unit_test_setup_teardown(test_rpc, setup, teardown),
     };
 
     return cmocka_run_group_tests(tests, NULL, NULL);
diff --git a/tests/src/test_tree_data.c b/tests/src/test_tree_data.c
index ff60fc8..25a1cfd 100644
--- a/tests/src/test_tree_data.c
+++ b/tests/src/test_tree_data.c
@@ -111,8 +111,8 @@
 
     assert_int_equal(LY_SUCCESS, lyd_compare(NULL, NULL, 0));
 
-    assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_DATA, NULL));
-    assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+    assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LY_SUCCESS, lyd_compare(tree1, tree2, 0));
     assert_int_equal(LY_ENOT, lyd_compare(tree1, tree2, LYD_COMPARE_FULL_RECURSION));
     assert_int_equal(LY_ENOT, lyd_compare(((struct lyd_node_inner*)tree1)->child, tree2, 0));
@@ -121,8 +121,8 @@
 
     data1 = "<l2 xmlns=\"urn:tests:a\"><c><x>a</x></c></l2><l2 xmlns=\"urn:tests:a\"><c><x>b</x></c></l2>";
     data2 = "<l2 xmlns=\"urn:tests:a\"><c><x>b</x></c></l2>";
-    assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_DATA, NULL));
-    assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+    assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LY_ENOT, lyd_compare(tree1, tree2, 0));
     assert_int_equal(LY_SUCCESS, lyd_compare(tree1->next, tree2, 0));
     lyd_free_all(tree1);
@@ -130,8 +130,8 @@
 
     data1 = "<ll xmlns=\"urn:tests:a\">a</ll><ll xmlns=\"urn:tests:a\">b</ll>";
     data2 = "<ll xmlns=\"urn:tests:a\">b</ll>";
-    assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_DATA, NULL));
-    assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+    assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LY_ENOT, lyd_compare(tree1, tree2, 0));
     assert_int_equal(LY_ENOT, lyd_compare(NULL, tree2, 0));
     assert_int_equal(LY_ENOT, lyd_compare(tree1, NULL, 0));
@@ -141,8 +141,8 @@
 
     data1 = "<c xmlns=\"urn:tests:a\"><x>x</x></c>";
     data2 = "<c xmlns=\"urn:tests:a\"><x>y</x></c>";
-    assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_DATA, NULL));
-    assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+    assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LY_SUCCESS, lyd_compare(tree1, tree2, 0));
     assert_int_equal(LY_ENOT, lyd_compare(tree1, tree2, LYD_COMPARE_FULL_RECURSION));
     lyd_free_all(tree1);
@@ -150,8 +150,8 @@
 
     data1 = "<c xmlns=\"urn:tests:a\"><x>x</x></c>";
     data2 = "<c xmlns=\"urn:tests:a\"><x>x</x><x>y</x></c>";
-    assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_DATA, NULL));
-    assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+    assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LY_SUCCESS, lyd_compare(tree1, tree2, 0));
     assert_int_equal(LY_ENOT, lyd_compare(tree1, tree2, LYD_COMPARE_FULL_RECURSION));
     lyd_free_all(tree1);
@@ -159,12 +159,12 @@
 
     data1 = "<any xmlns=\"urn:tests:a\"><x>x</x></any>";
     data2 = "<any xmlns=\"urn:tests:a\"><x>x</x><x>y</x></any>";
-    assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_DATA, NULL));
-    assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+    assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LY_ENOT, lyd_compare(tree1, tree2, 0));
     lyd_free_all(tree1);
     data1 = "<any xmlns=\"urn:tests:a\"><x>x</x><x>y</x></any>";
-    assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LY_SUCCESS, lyd_compare(tree1, tree2, 0));
     lyd_free_all(tree1);
     lyd_free_all(tree2);
@@ -182,7 +182,7 @@
     const char *result;
     const char *data = "<l1 xmlns=\"urn:tests:a\"><a>a</a><b>b</b><c>x</c></l1>";
 
-    assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_non_null(tree2 = lyd_dup(tree1, NULL, LYD_DUP_RECURSIVE));
     assert_int_equal(LY_SUCCESS, lyd_compare(tree1, tree2, LYD_COMPARE_FULL_RECURSION));
     lyd_free_all(tree1);
@@ -190,44 +190,44 @@
 
     data = "<l1 xmlns=\"urn:tests:a\"><a>a</a><b>b</b><c>x</c></l1>";
     result = "<l1 xmlns=\"urn:tests:a\"><a>a</a><b>b</b></l1>";
-    assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_non_null(tree2 = lyd_dup(tree1, NULL, 0));
     lyd_free_all(tree1);
-    assert_non_null(tree1 = lyd_parse_mem(ctx, result, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree1 = lyd_parse_mem(ctx, result, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LY_SUCCESS, lyd_compare(tree1, tree2, LYD_COMPARE_FULL_RECURSION));
     lyd_free_all(tree1);
     lyd_free_all(tree2);
 
     data = "<l2 xmlns=\"urn:tests:a\"><c><x>a</x></c></l2><l2 xmlns=\"urn:tests:a\"><c><x>b</x></c></l2>";
     result = "<l2 xmlns=\"urn:tests:a\"><c><x>a</x></c></l2>";
-    assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_non_null(tree2 = lyd_dup(tree1, NULL, LYD_DUP_WITH_SIBLINGS | LYD_DUP_RECURSIVE));
     assert_int_equal(LY_SUCCESS, lyd_compare(tree1, tree2, LYD_COMPARE_FULL_RECURSION));
     lyd_free_all(tree2);
 
     assert_non_null(tree2 = lyd_dup(tree1, NULL, LYD_DUP_RECURSIVE));
     lyd_free_all(tree1);
-    assert_non_null(tree1 = lyd_parse_mem(ctx, result, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree1 = lyd_parse_mem(ctx, result, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LY_SUCCESS, lyd_compare(tree1, tree2, LYD_COMPARE_FULL_RECURSION));
     lyd_free_all(tree2);
 
     assert_non_null(tree2 = lyd_dup(tree1, NULL, 0));
     lyd_free_all(tree1);
     result = "<l2 xmlns=\"urn:tests:a\"/>";
-    assert_non_null(tree1 = lyd_parse_mem(ctx, result, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree1 = lyd_parse_mem(ctx, result, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_int_equal(LY_SUCCESS, lyd_compare(tree1, tree2, LYD_COMPARE_FULL_RECURSION));
     lyd_free_all(tree1);
     lyd_free_all(tree2);
 
     data = "<any xmlns=\"urn:tests:a\"><c><a>a</a></c></any>";
-    assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_non_null(tree2 = lyd_dup(tree1, NULL, 0));
     assert_int_equal(LY_SUCCESS, lyd_compare(tree1, tree2, LYD_COMPARE_FULL_RECURSION));
     lyd_free_all(tree1);
     lyd_free_all(tree2);
 
     data = "<l2 xmlns=\"urn:tests:a\"><c><x>b</x></c></l2>";
-    assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_non_null(tree2 = lyd_dup(((struct lyd_node_inner*)((struct lyd_node_inner*)tree1)->child)->child, NULL, LYD_DUP_WITH_PARENTS));
     assert_string_equal("x", tree2->schema->name);
     assert_non_null(tree2->parent);
@@ -236,7 +236,7 @@
     lyd_free_all(tree2);
 
     data = "<l1 xmlns=\"urn:tests:a\"><a>a</a><b>b</b><c>c</c></l1>";
-    assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_non_null(tree2 = lyd_dup(((struct lyd_node_inner*)tree1)->child->prev, NULL, LYD_DUP_WITH_PARENTS));
     assert_string_equal("c", tree2->schema->name);
     assert_non_null(tree2->parent);
@@ -245,7 +245,7 @@
     lyd_free_all(tree2);
 
     data = "<l2 xmlns=\"urn:tests:a\"><c><x>b</x></c></l2>";
-    assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_non_null(tree2 = lyd_dup(tree1, NULL, 0));
     assert_non_null(lyd_dup(((struct lyd_node_inner*)((struct lyd_node_inner*)tree1)->child)->child,
                             (struct lyd_node_inner*)tree2, LYD_DUP_WITH_PARENTS));
@@ -255,7 +255,7 @@
 
     /* invalid */
     data = "<l1 xmlns=\"urn:tests:a\"><a>a</a><b>b</b><c>c</c></l1><l2 xmlns=\"urn:tests:a\"><c><x>b</x></c></l2>";
-    assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_DATA, NULL));
+    assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
     assert_null(lyd_dup(((struct lyd_node_inner*)tree1)->child->prev, (struct lyd_node_inner*)tree1->next, LYD_DUP_WITH_PARENTS));
     lyd_free_all(tree1);
 
diff --git a/tests/src/test_tree_schema_compile.c b/tests/src/test_tree_schema_compile.c
index b699dc8..d596455 100644
--- a/tests/src/test_tree_schema_compile.c
+++ b/tests/src/test_tree_schema_compile.c
@@ -181,7 +181,7 @@
                                                   "leaf a {type string;} container a{presence x;}}", &mod));
     lys_parser_ctx_free(ctx);
     assert_int_equal(LY_EVALID, lys_compile(&mod, 0));
-    logbuf_assert("Duplicate identifier \"a\" of data definition/RPC/action/Notification statement. /aa:a");
+    logbuf_assert("Duplicate identifier \"a\" of data definition/RPC/action/notification statement. /aa:a");
     assert_null(mod.compiled);
     reset_mod(&mod);
 
@@ -789,10 +789,10 @@
 
     assert_null(lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa;"
                               "choice ch {case a {leaf x {type string;}}leaf x {type string;}}}", LYS_IN_YANG));
-    logbuf_assert("Duplicate identifier \"x\" of data definition/RPC/action/Notification statement. /aa:ch/x/x");
+    logbuf_assert("Duplicate identifier \"x\" of data definition/RPC/action/notification statement. /aa:ch/x/x");
     assert_null(lys_parse_mem(ctx, "module aa2 {namespace urn:aa2;prefix aa;"
                               "choice ch {case a {leaf y {type string;}}case b {leaf y {type string;}}}}", LYS_IN_YANG));
-    logbuf_assert("Duplicate identifier \"y\" of data definition/RPC/action/Notification statement. /aa2:ch/b/y");
+    logbuf_assert("Duplicate identifier \"y\" of data definition/RPC/action/notification statement. /aa2:ch/b/y");
     assert_null(lys_parse_mem(ctx, "module bb {namespace urn:bb;prefix bb;"
                               "choice ch {case a {leaf x {type string;}}leaf a {type string;}}}", LYS_IN_YANG));
     logbuf_assert("Duplicate identifier \"a\" of case statement. /bb:ch/a");
@@ -887,14 +887,14 @@
     logbuf_assert("Invalid keyword \"action\" as a child of \"container\" - the statement is allowed only in YANG 1.1 modules. Line number 1.");
 
     assert_null(lys_parse_mem(ctx, "module bb {namespace urn:bb;prefix bb;leaf x{type string;} rpc x;}", LYS_IN_YANG));
-    logbuf_assert("Duplicate identifier \"x\" of data definition/RPC/action/Notification statement. /bb:x");
+    logbuf_assert("Duplicate identifier \"x\" of data definition/RPC/action/notification statement. /bb:x");
     assert_null(lys_parse_mem(ctx, "module cc {yang-version 1.1; namespace urn:cc;prefix cc;container c {leaf y {type string;} action y;}}", LYS_IN_YANG));
-    logbuf_assert("Duplicate identifier \"y\" of data definition/RPC/action/Notification statement. /cc:c/y");
+    logbuf_assert("Duplicate identifier \"y\" of data definition/RPC/action/notification statement. /cc:c/y");
     assert_null(lys_parse_mem(ctx, "module dd {yang-version 1.1; namespace urn:dd;prefix dd;container c {action z; action z;}}", LYS_IN_YANG));
-    logbuf_assert("Duplicate identifier \"z\" of data definition/RPC/action/Notification statement. /dd:c/z");
+    logbuf_assert("Duplicate identifier \"z\" of data definition/RPC/action/notification statement. /dd:c/z");
     ly_ctx_set_module_imp_clb(ctx, test_imp_clb, "submodule eesub {belongs-to ee {prefix ee;} notification w;}");
     assert_null(lys_parse_mem(ctx, "module ee {yang-version 1.1; namespace urn:ee;prefix ee;include eesub; rpc w;}", LYS_IN_YANG));
-    logbuf_assert("Duplicate identifier \"w\" of data definition/RPC/action/Notification statement. /ee:w");
+    logbuf_assert("Duplicate identifier \"w\" of data definition/RPC/action/notification statement. /ee:w");
 
     assert_null(lys_parse_mem(ctx, "module ff {yang-version 1.1; namespace urn:ff;prefix ff; rpc test {input {container a {leaf b {type string;}}}}"
                               "augment /test/input/a {action invalid {input {leaf x {type string;}}}}}", LYS_IN_YANG));
@@ -902,11 +902,11 @@
 
     assert_null(lys_parse_mem(ctx, "module gg {yang-version 1.1; namespace urn:gg;prefix gg; notification test {container a {leaf b {type string;}}}"
                               "augment /test/a {action invalid {input {leaf x {type string;}}}}}", LYS_IN_YANG));
-    logbuf_assert("Action \"invalid\" is placed inside Notification. /gg:{augment='/test/a'}/invalid");
+    logbuf_assert("Action \"invalid\" is placed inside notification. /gg:{augment='/test/a'}/invalid");
 
     assert_null(lys_parse_mem(ctx, "module hh {yang-version 1.1; namespace urn:hh;prefix hh; notification test {container a {uses grp;}}"
                               "grouping grp {action invalid {input {leaf x {type string;}}}}}", LYS_IN_YANG));
-    logbuf_assert("Action \"invalid\" is placed inside Notification. /hh:test/a/{uses='grp'}/invalid");
+    logbuf_assert("Action \"invalid\" is placed inside notification. /hh:test/a/{uses='grp'}/invalid");
 
     *state = NULL;
     ly_ctx_destroy(ctx, NULL);
@@ -959,14 +959,14 @@
     logbuf_assert("Invalid keyword \"notification\" as a child of \"container\" - the statement is allowed only in YANG 1.1 modules. Line number 1.");
 
     assert_null(lys_parse_mem(ctx, "module bb {namespace urn:bb;prefix bb;leaf x{type string;} notification x;}", LYS_IN_YANG));
-    logbuf_assert("Duplicate identifier \"x\" of data definition/RPC/action/Notification statement. /bb:x");
+    logbuf_assert("Duplicate identifier \"x\" of data definition/RPC/action/notification statement. /bb:x");
     assert_null(lys_parse_mem(ctx, "module cc {yang-version 1.1; namespace urn:cc;prefix cc;container c {leaf y {type string;} notification y;}}", LYS_IN_YANG));
-    logbuf_assert("Duplicate identifier \"y\" of data definition/RPC/action/Notification statement. /cc:c/y");
+    logbuf_assert("Duplicate identifier \"y\" of data definition/RPC/action/notification statement. /cc:c/y");
     assert_null(lys_parse_mem(ctx, "module dd {yang-version 1.1; namespace urn:dd;prefix dd;container c {notification z; notification z;}}", LYS_IN_YANG));
-    logbuf_assert("Duplicate identifier \"z\" of data definition/RPC/action/Notification statement. /dd:c/z");
+    logbuf_assert("Duplicate identifier \"z\" of data definition/RPC/action/notification statement. /dd:c/z");
     ly_ctx_set_module_imp_clb(ctx, test_imp_clb, "submodule eesub {belongs-to ee {prefix ee;} rpc w;}");
     assert_null(lys_parse_mem(ctx, "module ee {yang-version 1.1; namespace urn:ee;prefix ee;include eesub; notification w;}", LYS_IN_YANG));
-    logbuf_assert("Duplicate identifier \"w\" of data definition/RPC/action/Notification statement. /ee:w");
+    logbuf_assert("Duplicate identifier \"w\" of data definition/RPC/action/notification statement. /ee:w");
 
     assert_null(lys_parse_mem(ctx, "module ff {yang-version 1.1; namespace urn:ff;prefix ff; rpc test {input {container a {leaf b {type string;}}}}"
                               "augment /test/input/a {notification invalid {leaf x {type string;}}}}", LYS_IN_YANG));
@@ -974,7 +974,7 @@
 
     assert_null(lys_parse_mem(ctx, "module gg {yang-version 1.1; namespace urn:gg;prefix gg; notification test {container a {leaf b {type string;}}}"
                               "augment /test/a {notification invalid {leaf x {type string;}}}}", LYS_IN_YANG));
-    logbuf_assert("Notification \"invalid\" is placed inside another Notification. /gg:{augment='/test/a'}/invalid");
+    logbuf_assert("Notification \"invalid\" is placed inside another notification. /gg:{augment='/test/a'}/invalid");
 
     assert_null(lys_parse_mem(ctx, "module hh {yang-version 1.1; namespace urn:hh;prefix hh; rpc test {input {container a {uses grp;}}}"
                               "grouping grp {notification invalid {leaf x {type string;}}}}", LYS_IN_YANG));
@@ -2551,7 +2551,7 @@
 
     assert_null(lys_parse_mem(ctx, "module dd {namespace urn:dd;prefix dd;grouping grp{leaf a{type string;}}"
                                         "leaf a {type string;}uses grp;}", LYS_IN_YANG));
-    logbuf_assert("Duplicate identifier \"a\" of data definition/RPC/action/Notification statement. /dd:{uses='grp'}/dd:a");
+    logbuf_assert("Duplicate identifier \"a\" of data definition/RPC/action/notification statement. /dd:{uses='grp'}/dd:a");
 
     assert_null(lys_parse_mem(ctx, "module ee {namespace urn:ee;prefix ee;grouping grp {leaf l {type string; status deprecated;}}"
                                         "uses grp {status obsolete;}}", LYS_IN_YANG));
@@ -2559,10 +2559,10 @@
 
     assert_null(lys_parse_mem(ctx, "module ff {namespace urn:ff;prefix ff;grouping grp {leaf l {type string;}}"
                                         "leaf l {type int8;}uses grp;}", LYS_IN_YANG));
-    logbuf_assert("Duplicate identifier \"l\" of data definition/RPC/action/Notification statement. /ff:{uses='grp'}/ff:l");
+    logbuf_assert("Duplicate identifier \"l\" of data definition/RPC/action/notification statement. /ff:{uses='grp'}/ff:l");
     assert_null(lys_parse_mem(ctx, "module fg {namespace urn:fg;prefix fg;grouping grp {leaf m {type string;}}"
                                         "uses grp;leaf m {type int8;}}", LYS_IN_YANG));
-    logbuf_assert("Duplicate identifier \"m\" of data definition/RPC/action/Notification statement. /fg:m");
+    logbuf_assert("Duplicate identifier \"m\" of data definition/RPC/action/notification statement. /fg:m");
 
 
     assert_null(lys_parse_mem(ctx, "module gg {namespace urn:gg;prefix gg; grouping grp {container g;}"
@@ -2855,7 +2855,7 @@
 
     assert_null(lys_parse_mem(ctx, "module bb {namespace urn:bb;prefix bb; container c {leaf a {type string;}}"
                                         "augment /c {leaf a {type int8;}}}", LYS_IN_YANG));
-    logbuf_assert("Duplicate identifier \"a\" of data definition/RPC/action/Notification statement. /bb:{augment='/c'}/a");
+    logbuf_assert("Duplicate identifier \"a\" of data definition/RPC/action/notification statement. /bb:{augment='/c'}/a");
 
 
     assert_null(lys_parse_mem(ctx, "module cc {namespace urn:cc;prefix cc; container c {leaf a {type string;}}"
diff --git a/tests/src/test_validation.c b/tests/src/test_validation.c
index eaea51d..29ff064 100644
--- a/tests/src/test_validation.c
+++ b/tests/src/test_validation.c
@@ -75,6 +75,31 @@
                 "type string;"
             "}"
         "}";
+    const char *schema_b =
+        "module b {"
+            "namespace urn:tests:b;"
+            "prefix b;"
+            "yang-version 1.1;"
+
+            "choice choic {"
+                "mandatory true;"
+                "leaf a {"
+                    "type string;"
+                "}"
+                "case b {"
+                    "leaf l {"
+                        "type string;"
+                    "}"
+                "}"
+            "}"
+            "leaf c {"
+                "mandatory true;"
+                "type string;"
+            "}"
+            "leaf d {"
+                "type empty;"
+            "}"
+        "}";
 
 #if ENABLE_LOGGER_CHECKING
     ly_set_log_clb(logger, 1);
@@ -82,6 +107,7 @@
 
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, 0, &ctx));
     assert_non_null(lys_parse_mem(ctx, schema_a, LYS_IN_YANG));
+    assert_non_null(lys_parse_mem(ctx, schema_b, LYS_IN_YANG));
 
     return 0;
 }
@@ -124,19 +150,19 @@
     struct lyd_node *tree;
 
     data = "<c xmlns=\"urn:tests:a\">hey</c>";
-    assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, 0, NULL, &tree));
+    assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
     assert_null(tree);
     logbuf_assert("When condition \"/cont/b = 'val_b'\" not satisfied.");
 
     data = "<cont xmlns=\"urn:tests:a\"><b>val_b</b></cont><c xmlns=\"urn:tests:a\">hey</c>";
-    assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, 0, NULL, &tree));
+    assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
     assert_non_null(tree);
     assert_string_equal("c", tree->next->schema->name);
     assert_int_equal(LYD_WHEN_TRUE, tree->next->flags);
     lyd_free_all(tree);
 
     data = "<cont xmlns=\"urn:tests:a\"><a>val</a><b>val_b</b></cont><c xmlns=\"urn:tests:a\">val_c</c>";
-    assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, 0, NULL, &tree));
+    assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
     assert_non_null(tree);
     assert_string_equal("a", lyd_node_children(tree)->schema->name);
     assert_int_equal(LYD_WHEN_TRUE, lyd_node_children(tree)->flags);
@@ -147,10 +173,42 @@
     *state = NULL;
 }
 
+static void
+test_mandatory(void **state)
+{
+    *state = test_mandatory;
+
+    const char *data;
+    struct lyd_node *tree;
+
+    data = "<d xmlns=\"urn:tests:b\"/>";
+    assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+    assert_null(tree);
+    logbuf_assert("Mandatory node \"choic\" instance does not exist. /b:choic");
+
+    data = "<l xmlns=\"urn:tests:b\">string</l><d xmlns=\"urn:tests:b\"/>";
+    assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+    assert_null(tree);
+    logbuf_assert("Mandatory node \"c\" instance does not exist. /b:c");
+
+    data = "<a xmlns=\"urn:tests:b\">string</a>";
+    assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+    assert_null(tree);
+    logbuf_assert("Mandatory node \"c\" instance does not exist. /b:c");
+
+    data = "<a xmlns=\"urn:tests:b\">string</a><c xmlns=\"urn:tests:b\">string2</c>";
+    assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+    assert_non_null(tree);
+    lyd_free_withsiblings(tree);
+
+    *state = NULL;
+}
+
 int main(void)
 {
     const struct CMUnitTest tests[] = {
         cmocka_unit_test_setup_teardown(test_when, setup, teardown),
+        cmocka_unit_test_setup_teardown(test_mandatory, setup, teardown),
     };
 
     return cmocka_run_group_tests(tests, NULL, NULL);