[libxml2] Make schema validation fail with multiple top-level elements
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Make schema validation fail with multiple top-level elements
- Date: Mon, 4 May 2020 12:35:24 +0000 (UTC)
commit 4f2aee18f6e2d40e58eb224f4f7935dc2400fe25
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Mon May 4 14:03:52 2020 +0200
Make schema validation fail with multiple top-level elements
Closes #126.
xmlschemas.c | 4 ++++
1 file changed, 4 insertions(+)
---
diff --git a/xmlschemas.c b/xmlschemas.c
index a7804b78..81c47bc4 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]