node-xml2js
node-xml2js copied to clipboard
Text nodes erroneously combined
const {parseStringPromise, Builder} = require('xml2js');
parseStringPromise( '<apple>banana<carrot />durian</apple>' ).then( x => {
console.log( (new Builder()).buildObject( x ));
} )
Expected output: <apple>banana<carrot />durian</apple>
Actual output: <apple>bananadurian<carrot /></apple>
[email protected] on v14.16.1
Looking at the interim form of document created, this seems to be a bug with node-xml2js and not the builder: { apple: { _: 'bananadurian', carrot: [ '' ] } }