I'm having trouble converting some xml data to json data in the format it is expected. I'm new to all of these techniques and the resources I find online are difficult for me to decypher. Using the app I make in my plnkr, I can take the data in the data.json file and use it to create the chart using a charts library. I have the xml in the data.xml file - I think that it is in the correct format in order to be converted to json in the required format. How do I use the x2js library in order to convert the xml to json and implement it into my chart? I've been stuck on this for a while now, and haven't been able to figure out how to get it working.
Currently, the app takes the data.json file and implements it into the data for the charts. What is the easiest way to take the xml and do the same?
Edit: I've updated my plnkr with my attempt at converting the xml data to json. I even tried simply printing out the final data in json form - if the xml converted to json, but nothing came up. I entered a x2js.js file that has the functions from the library needed for the conversion I used in the service. I get the following error:
ReferenceError: data is not defined
at new <anonymous> (script.js:38)
at invoke (code.angularjs.org/1.2.2/angular.js:3641)
at Object.instantiate (code.angularjs.org/1.2.2/angular.js:3653)
at code.angularjs.org/1.2.2/angular.js:6684
at code.angularjs.org/1.2.2/angular.js:6097
at forEach (code.angularjs.org/1.2.2/angular.js:307)
at nodeLinkFn (code.angularjs.org/1.2.2/angular.js:6084)
at compositeLinkFn (code.angularjs.org/1.2.2/angular.js:5550)
at compositeLinkFn (code.angularjs.org/1.2.2/angular.js:5553)
at publicLinkFn (code.angularjs.org/1.2.2/angular.js:5458)
If anyone can help me out, its greatly appreciated.