XML data parser CHANGE set LYD_DEFAULT flag for empty non-presence containers.
diff --git a/src/parser_xml.c b/src/parser_xml.c
index fcd9681..48ddf73 100644
--- a/src/parser_xml.c
+++ b/src/parser_xml.c
@@ -323,6 +323,14 @@
/* calculate the hash and insert it into parent (list with keys is handled when its keys are inserted) */
lyd_hash(cur);
lyd_insert_hash(cur);
+
+ /* if we have empty non-presence container, we keep it, but mark it as default */
+ if (cur->schema->nodetype == LYS_CONTAINER && !((struct lyd_node_inner*)cur)->child &&
+ !cur->attr && !(((struct lysc_node_container*)cur->schema)->flags & LYS_PRESENCE)) {
+ cur->flags |= LYD_DEFAULT;
+ }
+
+ /* TODO context validation */
}
cleanup: