parser data FEATURE flag to parse validated data
diff --git a/src/parser_common.c b/src/parser_common.c
index cf509ca..765ef5a 100644
--- a/src/parser_common.c
+++ b/src/parser_common.c
@@ -246,6 +246,10 @@
struct lyd_meta *meta2, *prev_meta = NULL;
struct lyd_ctx_ext_val *ext_val;
+ if (lydctx->parse_opts & LYD_PARSE_NO_NEW) {
+ node->flags &= ~LYD_NEW;
+ }
+
if (lysc_has_when(node->schema)) {
if (lydctx->parse_opts & LYD_PARSE_WHEN_TRUE) {
/* the condition was true before */
diff --git a/src/parser_data.h b/src/parser_data.h
index 773947f..050ced3 100644
--- a/src/parser_data.h
+++ b/src/parser_data.h
@@ -162,6 +162,9 @@
#define LYD_PARSE_WHEN_TRUE 0x800000 /**< Mark all the parsed nodes dependend on a when condition with the flag
that means the condition was satisifed before. This allows for
auto-deletion of these nodes during validation. */
+#define LYD_PARSE_NO_NEW 0x1000000 /**< Do not set ::LYD_NEW (non-validated node flag) for any nodes. Use
+ when parsing validated data to skip some validation tasks and modify
+ some validation behavior (auto-deletion of cases). */
#define LYD_PARSE_OPTS_MASK 0xFFFF0000 /**< Mask for all the LYD_PARSE_ options. */