Make schema validation fail with multiple top-level elements
Closes #126.
diff --git a/xmlschemas.c b/xmlschemas.c
index a7804b7..81c47bc 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -27933,6 +27933,10 @@
VERROR(1, NULL, "The document has no document element");
return (1);
}
+ for (node = valRoot->next; node != NULL; node = node->next) {
+ if (node->type == XML_ELEMENT_NODE)
+ VERROR(1, NULL, "The document has more than one top element");
+ }
vctxt->depth = -1;
vctxt->validationRoot = valRoot;
node = valRoot;