node-xml2js icon indicating copy to clipboard operation
node-xml2js copied to clipboard

Text nodes erroneously combined

Open pjlsergeant opened this issue 4 years ago • 0 comments

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: [ '' ] } }

pjlsergeant avatar May 13 '21 01:05 pjlsergeant