1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-23 02:50:08 +03:00

Make schema validation fail with multiple top-level elements

Closes #126.
This commit is contained in:
Nick Wellnhofer 2020-05-04 14:03:52 +02:00
parent 106757e8c1
commit 4f2aee18f6

View File

@ -27933,6 +27933,10 @@ xmlSchemaVDocWalk(xmlSchemaValidCtxtPtr vctxt)
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;