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

Bug - Parsing will add the xmlns value to the name of the object

Open fcaride opened this issue 3 years ago • 0 comments

Hey there,

When im parsing an xml like this:

<CFE_Adenda xmlns:nsAdenda="http://cfe.dgi.gub.uy"> <CFE xmlns:nsAd="http://cfe.dgi.gub.uy" version="1.0"> ...some things </CFE> </CFE_Adenda>

I call the function like this:

require("xml2js").parseString; parseString( fr.result, { explicitArray: false, }, callback)

And for some reason the returning object is this:

nsAdenda:CFE_Adenda: { $: {xmlns:nsAdenda: undefined} nsAd:CFE: {$: {…}, nsAd:eFact: {…}, Signature: {…}} nsAdenda:Adenda: { ...some things } }

and it should be like this

CFE_Adenda: { (other tags) CFE: { ...some things} }

Somehow the xmlns is getting appended to the object.

Im using the version 0.4.23

Thanks

fcaride avatar Jul 02 '21 09:07 fcaride