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

valueProcessors question

Open fpedroza opened this issue 2 years ago • 0 comments

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.

fpedroza avatar Jun 17 '22 21:06 fpedroza