View Full Version : How to parsing XML using Ajax request?
25 Nov 2010, 2:27 AM
Hi, I was wondering how to use Ajax function to request a XML document and parse it into the data view? For example some RSS feed and etc?
ANd Is there a way like jQuery which had a ajax request with XML dataType? I would like to use JSON, but no server side to help me convert to JSON format...
To transfer XML to client, you can use the XmlReader with AjaxProxy. I don't have an example as all my stuff uses all JSON but I'm sure there is one somewhere...check the examples in the download.
Not sure what your backend is, but there are a myriad of options in .Net to do this. You can use LINQ to XML to query the XML and shove into a business object on the fly. Then use JSON.net to perform the conversion or use the new ASP.NET MVC framework...it makes this trivial to do now (this.Json(obj)).
25 Nov 2010, 6:24 AM
If you want to read rss (therefore an XML instead of a Json) you can take a look on this:
but i have to warn you that XMLReader can't read data form a complex/nested XML yet.
Nonetheless some developer posted on this (http://www.sencha.com/forum/showthread.php?115033-FIXED-583-nested-xml-complex-xml-cant-get-associations-to-work&highlight=nested) topic they are currently working on some changes that will be in the next release to make it work properly.
Powered by vBulletin® Version 4.1.5 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.