libyang CHANGE parsing/validation significantly refactored
diff --git a/src/parser_xml.c b/src/parser_xml.c
index ad1da1a..77d7f86 100644
--- a/src/parser_xml.c
+++ b/src/parser_xml.c
@@ -75,19 +75,12 @@
 
 /* logs directly */
 static int
-xml_get_value(struct lyd_node *node, struct lyxml_elem *xml, int options, int editbits)
+xml_get_value(struct lyd_node *node, struct lyxml_elem *xml, int editbits)
 {
     struct lyd_node_leaf_list *leaf = (struct lyd_node_leaf_list *)node;
-    int resolvable;
 
     assert(node && (node->schema->nodetype & (LYS_LEAFLIST | LYS_LEAF)) && xml);
 
-    if (options & (LYD_OPT_EDIT | LYD_OPT_GET | LYD_OPT_GETCONFIG)) {
-        resolvable = 0;
-    } else {
-        resolvable = 1;
-    }
-
     leaf->value_str = lydict_insert(node->schema->module->ctx, xml->content, 0);
 
     if ((editbits & 0x10) && (node->schema->nodetype & LYS_LEAF) && (!leaf->value_str || !leaf->value_str[0])) {
@@ -99,8 +92,7 @@
 
     /* the value is here converted to a JSON format if needed in case of LY_TYPE_IDENT and LY_TYPE_INST or to a
      * canonical form of the value */
-    if (!lyp_parse_value(&((struct lys_node_leaf *)leaf->schema)->type, &leaf->value_str, xml, NULL, leaf, 1,
-                         resolvable, 0)) {
+    if (!lyp_parse_value(&((struct lys_node_leaf *)leaf->schema)->type, &leaf->value_str, xml, leaf, 1, 0)) {
         return EXIT_FAILURE;
     }
 
@@ -280,7 +272,7 @@
             first_sibling = *result;
         }
     }
-    (*result)->validity = LYD_VAL_NOT;
+    (*result)->validity = ly_new_node_validity((*result)->schema);
     if (resolve_applies_when(schema, 0, NULL)) {
         (*result)->when_status = LYD_WHEN;
     }
@@ -382,7 +374,7 @@
     /* type specific processing */
     if (schema->nodetype & (LYS_LEAF | LYS_LEAFLIST)) {
         /* type detection and assigning the value */
-        if (xml_get_value(*result, xml, options, editbits)) {
+        if (xml_get_value(*result, xml, editbits)) {
             goto error;
         }
     } else if (schema->nodetype & LYS_ANYDATA) {
@@ -420,7 +412,7 @@
     }
 
     /* first part of validation checks */
-    if (!(options & LYD_OPT_TRUSTED) && lyv_data_context(*result, options, unres)) {
+    if (lyv_data_context(*result, options, unres)) {
         goto error;
     }
 
@@ -523,9 +515,8 @@
 
     /* rest of validation checks */
     ly_err_clean(1);
-    if (!(options & LYD_OPT_TRUSTED) &&
-            (lyv_data_content(*result, options, unres) ||
-             lyv_multicases(*result, NULL, prev ? &first_sibling : NULL, 0, NULL))) {
+    if (lyv_data_content(*result, options, unres) ||
+             lyv_multicases(*result, NULL, prev ? &first_sibling : NULL, 0, NULL)) {
         if (ly_errno) {
             goto error;
         } else {
@@ -536,9 +527,7 @@
     /* validation successful */
     if ((*result)->schema->nodetype & (LYS_LIST | LYS_LEAFLIST)) {
         /* postpone checking when there will be all list/leaflist instances */
-        (*result)->validity = LYD_VAL_UNIQUE;
-    } else {
-        (*result)->validity = LYD_VAL_OK;
+        (*result)->validity |= LYD_VAL_UNIQUE;
     }
 
     return ret;