I've installed node-xml but I don't think it works the way I expect. and it doesnt' have example. any recommendation for xml-2-json (js) for node.js? I also looked at xml2js in npm but it is deprecated and people reported that it is broken with the latest node.js
by the way, i'm also using express. :)
There are many xml parsers.
As for converting XML to JSON, I would recommend creating an object structure from your xml and then manually calling
JSON.stringify on it. This gives you complete control of how your xml data is turned into JSON.
You can then either save the JSON in a file/DB or serve it to a request.
libxmljs and node-o3-xml are great and fast, but beware that they both need to compile binary components. And if you are using them for a module that will be used by others, that caveat is even more serious.
Taking a higher-level view for a moment, remember that node is single-threaded. So, any XML parsing you do is going to block the node process. To me, that means that XML parsing should never be performed in the same process as your main app. Then, once you move XML parsing to a separate process, maybe a little speed can be sacrificed in favor of ease of installation and greater portability.