Skip to content

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

@brettz9

Description

@brettz9

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();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions