I am a newbie into Node.js
I have come across many XML 2 Json Conversions, None of them satisfied my needs up to the mark. Out of all this conversion supports, i get one or the other error as something is missing and don't support to the version.
Here is my code :
exports.index = function(req, res){
var request = require('request');
var url = 'xml-output-throwing-url';
request(url, function (error, response, body) {
if (!error && response.statusCode == 200) {
res.json(body);
}
});
};
This throws output of rendering the xml as : "http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"..someurl...">..Output.."
Which is enclosed by "". Now i am trying to convert this output to json and render this from backbone.js and make this presentation in a neat way. But the output will be empty when i am using JSON.stringify(this.model) in the render function.
What am I doing wrong here?
How to achieve this?
My doubts are : Do I need to convert xml to json from server side i.e from express.js or backbone. Which is best among this?
Thanks in Advance