Skip to content

fix(xml): preserve attributes when beautifying XML - #442

Merged
Chesterkxng merged 7 commits into
iib0011:mainfrom
Sushanth012:fix/xml-beautifier-attributes
Sep 22, 2026
Merged

Chesterkxng merged 7 commits into
iib0011:mainfrom
Sushanth012:fix/xml-beautifier-attributes

Conversation

@Sushanth012

Copy link
Copy Markdown
Contributor

Summary

  • Configure the XML parser to retain attributes.
  • Configure the XML builder to serialize retained attributes.
  • Add regression coverage for an element with multiple attributes.

Problem

XML Beautifier used fast-xml-parser defaults, which ignore attributes. Formatting input such as a user element with id and role attributes silently removed both attributes from the output, changing the document instead of only formatting it.

Testing

  • npx vitest run src/pages/tools/xml/xml-beautifier/xml-beautifier.service.test.ts
  • npm run typecheck

@Chesterkxng Chesterkxng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Job 💯 .
I have made small changes :)

@Chesterkxng
Chesterkxng merged commit 0adf991 into iib0011:main Sep 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants