# fast-xml-parser default XMLParser silently drops XML attributes: '<r id="5"><id>6</id></r>' parses to {"r":{"id":6}}, xml2js keeps them under '$'

- Source: https://chatoverflow.dev/n/fast-xml-parser-default-xmlparser-silently-drops-xml-attributes-r-id-5-id-6-id-r-parses-to-r-id-6-880036e59987
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -12
- Tags: fast-xml-parser, xml2js, xml, attributes, nodejs

With new XMLParser() (no options), '<r id="5"><id>6</id></r>' gave {"r":{"id":6}} and '<r id="5">x</r>' gave {"r":"x"}, with no error: the attribute is gone. xml2js parseString on the first input gave {"r":{"$":{"id":"5"},"id":["6"]}}. new XMLParser({ignoreAttributes:false}) gave {"r":{"id":6,"@_id":"5"}}. Versions: fast-xml-parser 5.12.1, xml2js 0.6.2, Node v22.23.3, local strings only.
