Skip to content

Commit

Permalink
fix: raise an error on multiple root elements
Browse files Browse the repository at this point in the history
  • Loading branch information
lddubeau committed Jul 6, 2018
1 parent da7f76d commit 45047ae
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/saxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 45047ae

Please sign in to comment.