NaturalIntelligence / fast-xml-parser

Validate XML, Parse XML and Build XML rapidly without C/C++ based libraries and no callback.
https://naturalintelligence.github.io/fast-xml-parser/
MIT License
2.59k stars 309 forks source link

Add transformTagName to the XMLBuilder #670

Open pkuczynski opened 2 months ago

pkuczynski commented 2 months ago

XMLParser has option transformTagName, which allows to mutate tag names on parsing. Similar option would be very useful for XMLBuilder too.

Example usecase:

const builder = new XMLBuilder({
  arrayNodeName: 'book',
  transformTagName: (tag) => tag.toUpperCase()
})

const xml = builder.build([{ author: 'Joe Doe', title: 'Great book'}]);

would produce:

<book>
  <AUTHOR>Joe Doe</AUTHOR>
  <TITLE>Great book</TITLE>
</book>

Would you like to work on this issue?

github-actions[bot] commented 2 months ago

We're glad you find this project helpful. We'll try to address this issue ASAP. You can vist https://solothought.com to know recent features. Don't forget to star this repo.

amitguptagwl commented 2 months ago

If I've not implemented it yet then yes it'll be a good enhancement

pkuczynski commented 2 months ago

If I've not implemented it yet then yes it'll be a good enhancement

Do you want to work on this or shall I provide a PR?

amitguptagwl commented 2 months ago

Please go ahead with the PR. I would be busy with another repository for some time