Open scottwillman opened 1 year ago
It appears that if the charkey matches the name of a child node the return value breaks in a very interesting way. Took me a while to figure out what was going on.
charkey
In this example:
const test = ` <meters> <meter> <key>engine</key> <value>1747</value> <units>hrs</units> </meter> </meters>`;
With these options:
await xml2js.parseStringPromise(test, { explicitArray: false, charkey: 'value', });
Produces this result:
{ "meters": { "meter": { "value": "\n \n ,1747\n \n ", "key": "engine", "units": "hrs" } } }
I'm not exactly sure what the right behaviour is here, but possibly worth warning in the docs.
It appears that if the
charkey
matches the name of a child node the return value breaks in a very interesting way. Took me a while to figure out what was going on.In this example:
With these options:
Produces this result:
I'm not exactly sure what the right behaviour is here, but possibly worth warning in the docs.