npm / fast-xml-parser
fast-xml-parser
What changed in fast-xml-parser 4 to 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
25 breaking16 security2 deprecations13 new APIs and options6 performance7 behavior and defaults1 tooling18 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initfast-xml-parser 556 changes
Breaking changes 8
Uint8Array XML input is decoded as UTF-8.
DOCTYPE entity names and notation names are validated using qname for backward compatibility; validation also considers xml-version, which defaults to '1.0'.
Entity values can no longer be used to form another entity name; entity scanning is single-pass.
Adding a numeric external entity is no longer allowed.
Error messages for entities might have changed.
Callbacks receive a readonly matcher instance, preventing accidental push or pop calls.
XMLBuilder is split into the fast-xml-builder package; import it from that package instead of fast-xml-parser.
X2jOptions is no longer exported at its declaration site, so developers can no longer import it from that export.
Security 16
fast-xml-parser: Quadratic CPU consumption scanning unterminated stop-node tags
fast-xml-parser: Repeated DOCTYPE declarations reset entity expansion limits
Unsafe HTML or XML data in doctype entities is validated using the is-unsafe library; users can override the rules by overriding EntityDecoder.
Malicious CDATA and comment content is sanitized by fast-xml-builder.
Fixes entity expansion limits.
fast-xml-parser affected by numeric entity expansion bypassing all entity expansion limits (incomplete fix for CVE-2026-26278)
fast-xml-parser has stack overflow in XMLBuilder with preserveOrder
Adds an option for allowed tags as part of improved entity processing security and performance.
fast-xml-parser affected by DoS through entity expansion in DOCTYPE (no expansion limit)
Adds an option to limit entity size, improving security and performance of entity processing.
Adds an option to limit expanded length, improving security and performance of entity processing.
Adds an option to limit entity expansion depth, improving security and performance of entity processing.
Adds an option to limit total entity expansions, improving security and performance of entity processing.
Adds a tag filter option as part of improved entity processing security and performance.
Regex characters in entity names are escaped.
fast-xml-parser has RangeError DoS Numeric Entities Bug
Deprecations 2
The addEntity API is deprecated.
XMLBuilder will be removed from fast-xml-parser in a future major version; migrate to fast-xml-builder.
New APIs and options 5
Node metadata now supports endIndex, allowing developers to access the end index.
Number parsing options can now be set for hex, binary, enotation, infinity, and unicode.
Octal and binary parsing can be enabled; both are off by default.
Adds support for path-expression-matcher.
Adds support for maxNestedTags.
Performance 6
Quoted attribute values are skipped in one step, making long SVG path data 4–5x faster.
When processEntities is true, performance may degrade by approximately 8–10% without a separately passed entity decoder; with one, performance is unchanged when there are no entities and improved when there are.
Improves performance of stopNode checking.
The release notes mention saving use of js properties, without further detail.
Entity processing returns quickly when no entity is present.
Performance improvement for stopNodes.
Behavior and default changes 4
The builder can sanitize tag names when it finds them invalid.
Numerical external entities are allowed for backward compatibility.
The error message when the entity expansion limit is crossed might change.
The default entity size limit is increased to 10000.
Tooling 1
The typings file is combined to avoid requiring configuration changes.
Fixes and other changes 14
Adds endIndex to the CommonJS XMLMetaData declaration so the declaration includes this metadata field.
Preserves original metadata offsets when parsing CRLF input.
The version parameter is typed as a number.
The parser no longer crashes when it encounters a closing tag with no matching opening tag.
The builder's output formatting is fixed.
Creates a text node when attributes are present on a self-closing node.
Fixes the stop node expression when the namespace prefix is removed.
Fixes attributesGroupName when used with preserveOrder.
Fixes a stack overflow when a tag expression is very long.
Setting ignoreAttributes is no longer required to set the XML version for an NCR entity value.
Fixes parsing so stopNode is not parsed.
The XML builder handles non-array input when preserveOrder is true.
Missing exports were added to the CommonJS types, making them available to developers using the package's CommonJS typings.
Fixed an issue where transformTagName with allowBooleanAttributes adds an unnecessary attribute.
fast-xml-parser 432 changes
Breaking changes 17
In parser output with preserveOrder:true, attrMap is renamed to attibutes.
The configuration property attrNodeName is renamed to attributesGroupName.
The configuration property attrValueProcessor is renamed to attributeValueProcessor.
CDATA is no longer parsed.
The configuration property cdataTagName is renamed to cdataPropName.
The CLI and browser bundle are renamed to fxparser.
The configuration property numParseOptions is renamed to numberParseOptions.
Parser results are now returned as an array to provide a common structure and root-level detail.
The configuration property parseNodeValue is renamed to parseTagValue.
The configuration property ignoreNameSpace is renamed to removeNSPrefix.
Stop nodes are skipped when building XML from a JS object.
The processor is now called for stop nodes.
Processing behavior changes to include extra input parameters.
XML Builder suppresses unpaired tags by default.
An error is thrown when extra text follows XML content.
An XML parser instance must be built for the chosen options before parsing XML.
j2xparser is renamed to XMLBuilder.
New APIs and options 8
A commentPropName configuration property is added.
HTML document parsing is supported.
The isArray option parses a tag into an array.
Processing of PI Tags is supported.
The option renders XML so the resulting JS object maintains the order of properties from the XML.
XML Builder supports suppressBooleanAttributes for attributes with value true.
Unpaired tags are supported.
XML entities, HTML entities, and DOCTYPE entities are supported.
Behavior and default changes 3
External entities are supported without a DOCTYPE.
A global stopNodes expression such as "*.stop" is supported.
Attributes can be separated from a tag name by a newline.
Fixes and other changes 4
Attribute values can contain newlines.
Fixed an issue involving a tag with the name attributes.
The spelling of suppressEmptyNode is corrected.
Fixed a bug when an attribute has no value but contains only '='.