Kamal Nayan Deo
Kamal Nayan Deo

Reputation: 13

How to parse xml file for windows phone application using javascript or jquery?

i have to read a server side xml file using javascript or jquery or Ajax, if anyone have any idea regarding the same then please guide me.

Upvotes: 0

Views: 137

Answers (1)

fan
fan

Reputation: 21

I would recommend this jQuery Plugin: http://www.fyneworks.com/jquery/xml-to-json/

Here's an example of how to get the xml-data and using the plugin above to convert the xml to json:

$.get('http://example.com/data.xml', function(xml) {
  var json = $.xml2json(xml);
  console.log(json);
});

In the json variable now lies your parsed xml-data.

Let's use this xml data for the sample:

'<xml><user>fan</user></xml>';

alert(json.user) would display "fan".

Hope I could help you out.

Greetings.

Upvotes: 1

Related Questions