fast-xml-parser
fast-xml-parser copied to clipboard
how to change the attribute tag name
is there any way to change the attribute tag name using this module like xml2js
eg.
<test attribute-name="test"></test>
to produce a result like this
test: { attributeName: "test", }
I'm glad you find this repository helpful. I'll try to address your issu ASAP. You can watch the repo for new changes or star it.
@cckowin we can currently do the alteration in values only. We can think about to change it for both value and names. Or probably a separate name processor. Thanks
A processor for tag and attribute names would also allow for case insensitive xml files, just by using
(name) => name.toLowerCase().
We can probably reuse attributeValueProcessor to return an object where the key represents attribute name. However, in this case, user will lose the feature of parsing attribute value to some object.
https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#transformattributename