diff --git a/spec/entities_spec.js b/spec/entities_spec.js index bb66ab78..20d50331 100644 --- a/spec/entities_spec.js +++ b/spec/entities_spec.js @@ -128,6 +128,13 @@ describe("XMLParser Entities", function() { expect(result).toEqual(expected); }); + it("should not throw error when DTD comments contain '<' or '>'", function() { + const xmlData = ` < -->]>`; + + const parser = new XMLParser(); + parser.parse(xmlData); + }); + it("should parse attributes having '>' in value", function() { const xmlData = ` @@ -525,4 +532,4 @@ describe("XMLParser External Entites", function() { expect(result).toEqual(expected); }); -}); \ No newline at end of file +}); diff --git a/src/xmlparser/DocTypeReader.js b/src/xmlparser/DocTypeReader.js index fd7441ff..2c69dfe9 100644 --- a/src/xmlparser/DocTypeReader.js +++ b/src/xmlparser/DocTypeReader.js @@ -14,7 +14,7 @@ function readDocType(xmlData, i){ let hasBody = false, entity = false, comment = false; let exp = ""; for(;i