From bc1e1d4d192831fbb07ec35a4fcb1f818ce4c5a0 Mon Sep 17 00:00:00 2001 From: Louis-Dominique Dubeau Date: Thu, 5 Jul 2018 19:26:04 -0400 Subject: [PATCH] fix: treat ?? in processing instructions correctly --- lib/saxes.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/saxes.js b/lib/saxes.js index f6516011..17e85b83 100644 --- a/lib/saxes.js +++ b/lib/saxes.js @@ -543,6 +543,13 @@ class SAXParser { this.piTarget = this.piBody = ""; this.state = S_TEXT; } + else if (c === "?") { + // We ran into ?? as part of a processing instruction. We initially + // took the first ? as a sign that the PI was ending, but it is + // not. So we have to add it to the body but we take the new ? as a + // sign that the PI is ending. + this.piBody += "?"; + } else { this.piBody += `?${c}`; this.state = S_PI_BODY;