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

Unexpected errors for numeric character references that represent < or & #1

Open
brettz9 opened this issue Dec 23, 2021 · 0 comments · May be fixed by #3
Open

Unexpected errors for numeric character references that represent < or & #1

brettz9 opened this issue Dec 23, 2021 · 0 comments · May be fixed by #3

Comments

@brettz9
Copy link

brettz9 commented Dec 23, 2021

Hi,

Appreciate the tool!

However, as discovered through the process of investigating this issue, I'm getting "Invalid character in entity name" or " Invalid attribute name" errors with the following numeric character references (hex or dec) representing < or &, where it should not:

const SAX = require('@trysound/sax');
const sax = SAX.parser(true, {
  strict: true,
  trim: false,
  normalize: false,
  lowercase: true,
  xmlns: true,
  position: true,
});
sax.onerror = (e) => {
  console.error('Erred', e);
};
sax.write(
  // Neither of these work (< and &, respectfully):
  // <svg><text class="&#60; and &#x3c;">&#x3c; and &#60;</text></svg>
  '<svg><text class="&#38; and &#x26;">&#x26; and &#38;</text></svg>'
).close();
brettz9 added a commit to brettz9/sax that referenced this issue Dec 23, 2021
…nd &, as otherwise may break well-formedness; fixes svg#1
brettz9 added a commit to brettz9/sax that referenced this issue Dec 23, 2021
…&` as is, as otherwise may break well-formedness; fixes svg#1
brettz9 added a commit to brettz9/sax that referenced this issue Dec 23, 2021
…to `&lt;` and `&amp;`, as otherwise may break well-formedness; fixes svg#1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant