Leonidas-from-XIV / node-xml2js

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

valueProcessors question #649

Open fpedroza opened 2 years ago

fpedroza commented 2 years ago

Question about valueProcessors option:

Given this setup:

const xml2jsParser = new xml2js.Parser({
    explicitArray: false,  // Always put child nodes in an array if true; otherwise an array is created only if there is more than one.
    explicitRoot: true,
    mergeAttrs: true,  // Merge attributes and child elements as properties of the parent, instead of keying attributes off a child attribute object.
    valueProcessors: [
        function (value, name) {
            console.log(`name ${name}, value ${value}`);
            return value
        }
    ]
});

Is it true that I would expect to see output for every XML tag and value that I parsing using: xml2jsParser.parseString(xml, (err, json) => { result = json });

I ask because I am NOT seeing that behavior.

This is in 0.4.23.