Skip to content

v5.7.x rejects valid XML numeric character references like 
 #825

@danibuiza

Description

@danibuiza

Description

After upgrading from fast-xml-parser@5.5.8 to 5.7.1, the parser rejects valid XML numeric character references such as 
 (carriage return).

Error Message

Error: [EntityReplacer] Invalid character '#' in entity name: "#xD"

Reproduction

This occurs when parsing XML responses from AWS S3 (via @aws-sdk/xml-builder which uses fast-xml-parser). AWS S3 responses contain XML with standard numeric character references like 
.

Expected Behavior


 is a valid XML numeric character reference representing carriage return (U+000D). According to the XML specification, numeric character references in the form &#xNNNN; (hexadecimal) or &#NNNN; (decimal) should be accepted.

Reference: https://www.w3.org/TR/xml/#NT-CharRef

Root Cause Hypothesis

The issue appears to be related to the dependency change in v5.7.x from fast-xml-builder to @nodable/entities. The new entity handling seems to incorrectly treat #xD as an entity name rather than recognizing it as a numeric character reference.

Environment

  • fast-xml-parser version: 5.7.1
  • Node.js version: 24.x
  • Downstream dependency: @aws-sdk/xml-builder (AWS SDK v3)

Workaround

Pinning to fast-xml-parser@5.5.8 resolves the issue.

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