Leonidas-from-XIV / node-xml2js

XML to JavaScript object converter.
MIT License
4.84k stars 598 forks source link

"Invalid character in name" error when exporting #602

Open msmock opened 3 years ago

msmock commented 3 years ago

If the XML file is parsed with the "xmlns: true" option, the XMLStringifier throws an "Invalid character in name" error when exporting. It struggles with the name "$ns" which is generated using the "xmlns: true" option and does not seem to match the regex pattern in the assertLegalName function.

The stack is:

Error: Invalid character in name at XMLStringifier.module.exports.XMLStringifier.assertLegalName (/Users/msmock/node_modules/xmlbuilder/lib/XMLStringifier.js:213:15) at XMLStringifier.assertLegalName (/Users/msmock/node_modules/xmlbuilder/lib/XMLStringifier.js:4:59) at XMLStringifier.module.exports.XMLStringifier.name (/Users/msmock/node_modules/xmlbuilder/lib/XMLStringifier.js:29:19) ...