data tree FEATURE lyd_new_implicit* functions
Separate functionality that was included
only in validation before.
diff --git a/src/parser_xml.c b/src/parser_xml.c
index 0254a81..bc8b7e7 100644
--- a/src/parser_xml.c
+++ b/src/parser_xml.c
@@ -592,8 +592,9 @@
LY_CHECK_GOTO(ret, cleanup);
/* add any missing default children */
- ret = lyd_validate_defaults_r(cur, lyd_node_children_p(cur), NULL, NULL, &lydctx->unres_node_type,
- &lydctx->when_check, lydctx->options, NULL);
+ ret = lyd_new_implicit_r(cur, lyd_node_children_p(cur), NULL, NULL, &lydctx->unres_node_type,
+ &lydctx->when_check, (lydctx->options & LYD_VALIDATE_NO_STATE)
+ ? LYD_IMPLICIT_NO_STATE : 0, NULL);
LY_CHECK_GOTO(ret, cleanup);
}
@@ -717,8 +718,8 @@
LY_CHECK_GOTO(ret = lyd_validate_new(first2, NULL, mod, NULL), cleanup);
/* add all top-level defaults for this module */
- ret = lyd_validate_defaults_r(NULL, first2, NULL, mod, &lydctx.unres_node_type, &lydctx.when_check,
- validate_options, NULL);
+ ret = lyd_new_implicit_r(NULL, first2, NULL, mod, &lydctx.unres_node_type, &lydctx.when_check,
+ validate_options & LYD_VALIDATE_NO_STATE ? LYD_IMPLICIT_NO_STATE : 0, NULL);
LY_CHECK_GOTO(ret, cleanup);
/* finish incompletely validated terminal values/attributes and when conditions */