0

Is there any way in which I can do XML Paring in SproutCore (or convert it to JSON) so as to use it in conjunction with Datastore and Records?

Thanks a ton in advance! :D

codeBearer
  • 5,114
  • 4
  • 25
  • 29

1 Answers1

1

I don't believe there is anything native in SC1 or SC2 to parse XML.

You can always use jQuery which can be accessed from both SC1 and SC2. http://api.jquery.com/jQuery.parseXML/

Regards Vibul

Veebs
  • 2,390
  • 13
  • 10
  • Forgot to add, if you are using SC1 and SC.Request/Response to retrieve the XML from your server, I think the 'body' property will be parsed as XML if in SC.Request you set the 'isXML' property to true. – Veebs Nov 17 '11 at 01:28
  • But I still have to do manual parsing if I am to use it with a datasource, don't I? Again, thanks a ton for your replies. :) – codeBearer Nov 17 '11 at 20:25
  • Additionally, this is the way I'm currently (manually) performing XML parsing: http://stackoverflow.com/questions/649614/xml-parsing-in-javascript There is also a neat tutorial in the answer link. :) – codeBearer Nov 17 '11 at 20:26
  • Yes, I believe you have to read the XML and map it to your record property. – Veebs Nov 21 '11 at 04:11