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

BUG: Non-strict entity detection misses close tag #249

Open
solter opened this issue Sep 15, 2021 · 0 comments
Open

BUG: Non-strict entity detection misses close tag #249

solter opened this issue Sep 15, 2021 · 0 comments

Comments

@solter
Copy link

solter commented Sep 15, 2021

Problem

When an xml file has data that looks like

<root>
  <a>content&x</a>
  <b/>
</root>

and the strict mode is off, then the parser ends up calling ontext event with the value of
content&x</a>\n .

Root cause

This is caused by the assumption that when an illegal entity character is parsed it should remain part of the text for the tag, which occurs at lib/sax.js line 1492.

Solution outline

To fix this would probably require changing the code around line 1492 to something like the following

i-- // reprocess the illegal character
parser[buffer] += '&' + parser.entity
parser.entity = ''
parser.state = returnState
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant