diff --git a/lib/saxes.js b/lib/saxes.js index a1920d82..0a8ea1a5 100644 --- a/lib/saxes.js +++ b/lib/saxes.js @@ -1114,7 +1114,7 @@ ${XML_NAMESPACE}.`); let num = NaN; if (entity[0] === "#") { - if ((entity[1] === "x" || entity[1] === "X") && + if ((entity[1] === "x") && /^#[x|X][0-9a-fA-F]+$/.test(entity)) { num = parseInt(entity.slice(2), 16); } diff --git a/test/issue-35.js b/test/issue-35.js index 0de9e3f0..d27916ba 100644 --- a/test/issue-35.js +++ b/test/issue-35.js @@ -3,7 +3,7 @@ // https://github.com/isaacs/sax-js/issues/35 require(".").test({ name: "issue 35 (leading 0 in entity numeric code)", - xml: " \n", + xml: " \n", expect: [ ["opentagstart", { name: "xml", attributes: {} }], ["opentag", { name: "xml", attributes: {}, isSelfClosing: false }],