Skip to content

Parser supports & for ampersand, but not &#038 #815

@KingGamingYT

Description

@KingGamingYT
  • Are you running the latest version?
  • Have you checked if you are using correct configuration?
  • Did you try online tool?
  • Have you checked the docs for helpful APIs and examples?

Description

While the parser supports both &amp and &#38 for the character &, it does not support the unicode entity &#038 for the same character, and it can't be manually added through the addEntity method on the parser due to & being disallowed from being added.

Input

Attempt to parse a piece of XML which contains the entity &#038 in a field.

Code

const parser = new XMLParser({ ignoreDeclaration: true, ignoreAttributes: false, attributeNamePrefix: "_", numberParseOptions: { leadingZeros: false, hex: true } });
parser.parse(`<title>Crimson Desert dev has started R&#038;D on a Nintendo Switch 2 version</title>`)

Output

{
    "title": "Crimson Desert dev has started R&#038;D on a Nintendo Switch 2 version"
}

expected data

{
    "title": "Crimson Desert dev has started R&D on a Nintendo Switch 2 version"
}

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