Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using '<' and '>' in comment in doctype markup declaration list #530

Open
5 of 6 tasks
Cwazywierdo opened this issue Jan 8, 2023 · 1 comment · Fixed by #533
Open
5 of 6 tasks

Error when using '<' and '>' in comment in doctype markup declaration list #530

Cwazywierdo opened this issue Jan 8, 2023 · 1 comment · Fixed by #533
Labels
Pending Pending to be confirmed by user/author for some check/update/implementation

Comments

@Cwazywierdo
Copy link
Contributor

Cwazywierdo commented Jan 8, 2023

  • Are you running the latest version?
  • Have you included sample input, output, error, and expected output?
  • Have you checked if you are using correct configuration?
  • Did you try online tool?

Description

Trying to parse comments containing '<' or '>' inside the DOCTYPE markup declaration list results in errors. The errors are different depending on whether '<' or '>' was used (or which appears first). This is not an issue if the comment is elsewhere in the file.

Code and output

const xmlStr = `
<!DOCTYPE greeting [
  <!-- < -->
  <!ELEMENT greeting (#PCDATA)>
]>
<greeting>Hello, world!</greeting>
`

const parser = new fxparser.XMLParser();
const output = parser.parse(xmlStr);

out:

Uncaught Error: Invalid DOCTYPE
    readDocType DocTypeReader.js:73
    parseXml OrderedObjParser.js:245
    parse XMLParser.js:35
DocTypeReader.js:73:26
const xmlStr = `
<!DOCTYPE greeting [
  <!-- > -->
  <!ELEMENT greeting (#PCDATA)>
]>
<greeting>Hello, world!</greeting>
`

const parser = new fxparser.XMLParser();
const output = parser.parse(xmlStr);

out:

Uncaught Error: Invalid XML comment in DOCTYPE
    readDocType DocTypeReader.js:82
    parseXml OrderedObjParser.js:245
    parse XMLParser.js:35
DocTypeReader.js:82:30

Probably not important, but I feel I should note that while the online version still throws errors, the error messages are different. '<' and '>' throw Error: Start tag expected.:1:undefined and Error: char 'E' is not expected.:3:5 respectively.

Would you like to work on this issue?

  • Yes
  • No

Bookmark this repository for further updates.

@github-actions
Copy link

github-actions bot commented Jan 8, 2023

I'm glad you find this repository helpful. I'll try to address your issue ASAP. You can watch the repo for new changes or star it.

@Cwazywierdo Cwazywierdo changed the title Error when using '<' and '>' in doctype markup declaration list Error when using '<' and '>' in comment in doctype markup declaration list Jan 8, 2023
@amitguptagwl amitguptagwl added the Pending Pending to be confirmed by user/author for some check/update/implementation label Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pending Pending to be confirmed by user/author for some check/update/implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants