Leonidas-from-XIV / node-xml2js

XML to JavaScript object converter.
MIT License
4.88k stars 602 forks source link

[Feature Request] namekey #518

Open fantasyui-com opened 5 years ago

fantasyui-com commented 5 years ago

Similar to attrkey and childkey we need a namekey to set '#name' to whatever we want.

fantasyui-com commented 5 years ago

I think the #name will interfere with es6+ private class fields, I just had node v12.8.0 complain but this needs a confirmation I shut off preserveChildrenOrder and looked for a different path.

fantasyui-com commented 5 years ago

For those of you with the same problem use xml-js module from npm

import convert from 'xml-js'; const options = {ignoreComment: true, alwaysChildren: true}; const result = convert.xml2js(xml, options);