xml parser CHANGE handle mixed XML content
mixed XML content is not allowed, do the detection inside the XML parser
to avoid need of checking it by the callers
diff --git a/src/parser_xml.c b/src/parser_xml.c
index 066a4d1..86ae99a 100644
--- a/src/parser_xml.c
+++ b/src/parser_xml.c
@@ -217,7 +217,12 @@
if (ctx->status == LYXML_ELEM_CONTENT) {
/* get the value */
- lyxml_get_string((struct lyxml_context *)ctx, data, &buffer, &buffer_size, &value, &value_len, &dynamic);
+ LY_ERR r = lyxml_get_string((struct lyxml_context *)ctx, data, &buffer, &buffer_size, &value, &value_len, &dynamic);
+ if (r == LY_EINVAL) {
+ /* just indentation of a child element found */
+ LOGVAL(ctx->ctx, LY_VLOG_LINE, &ctx->line, LYVE_SYNTAX, "Child element inside terminal node \"%s\" found.", cur->schema->name);
+ goto cleanup;
+ }
lyd_value_validate((struct lyd_node_term*)cur, value, value_len,
LY_TYPE_VALIDATE_CANONIZE | (dynamic ? LY_TYPE_VALIDATE_DYNAMIC : 0));
}