Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

valueProcessors question #649

Open
fpedroza opened this issue Jun 17, 2022 · 0 comments
Open

valueProcessors question #649

fpedroza opened this issue Jun 17, 2022 · 0 comments

Comments

@fpedroza
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant