From 45047ae97b4dfc62da8782e9413348880e92d09e Mon Sep 17 00:00:00 2001 From: Louis-Dominique Dubeau Date: Thu, 5 Jul 2018 18:56:31 -0400 Subject: [PATCH] fix: raise an error on multiple root elements --- lib/saxes.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/saxes.js b/lib/saxes.js index eb7df19f..f6516011 100644 --- a/lib/saxes.js +++ b/lib/saxes.js @@ -1023,6 +1023,9 @@ ${XML_NAMESPACE}.`); tag.isSelfClosing = !!selfClosing; // process the tag + if (this.closedRoot) { + this.fail("Documents may contain only one root."); + } this.sawRoot = true; this.tags.push(tag); this.emitNode("onopentag", tag);