My code is always printing error log, how can i find the exception please tell me the right way to this
Here is my code
this.http.get(‘http://www.gazetaexpress.com/rss/sport/?xml=1’).subscribe(data => {
this.xmlItems = JSON.stringify(data);
console.log(typeof(this.xmlItems));
xml2js.parseString(this.xmlItems, function (err, result) {
console.log(result);
});
}, error => {
console.log(JSON.stringify(error));
});
I think data is XML. So JSON.stringify won’t work with XML data
so please give me possible solution how can i read this data…
Try this.xmlitems = data
And you can console.log(data) to check what data holds.
I would love to suggest a tool which help me to survive,
https://codebeautify.org/xmltojson