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.49k stars 302 forks source link

Add transformAttributeName to transform the attribute name upon parsing #519

Closed erkie closed 1 year ago

erkie commented 1 year ago

Purpose / Goal

In my previous PR I added transformTagName https://github.com/NaturalIntelligence/fast-xml-parser/pull/469 To keep it consistent I've added a transformAttributeName with the same function and signature.

Type

Please mention the type of PR

Also included documentation and updated type definitions.

Example:

const parser = new XMLParser({
  transformAttributeName: (attr) => attr.toLowerCase()
});
let result = parser.parse(xmlData);
coveralls commented 1 year ago

Coverage Status

Coverage increased (+0.008%) to 98.454% when pulling 458a34e35493d7b34febe5253044a99ad6daaaac on feederco:master into f900ef83a62e08089489c5bd17d90b677f3f3a6f on NaturalIntelligence:master.

manuelmhtr commented 1 year ago

@amitguptagwl this change is not on NPM yet. Any chance a new version is published soon?

amitguptagwl commented 1 year ago

waiting to get merge one more PR. So will publish soon.