1. #1
    Sencha Premium Member
    Join Date
    Feb 2012
    Posts
    9
    Vote Rating
    0
    clippernet is on a distinguished road

      0  

    Default Unanswered: XML parsing

    Unanswered: XML parsing


    Hello,

    I have data from a web server in XML format and would like to parse this directly, without a store. Just like the JSON decode command.

    The reason I don't want to use a store is because I have lots of different xml formats and I prefer not to have to create all these different stores in my application.

    Is there any command or workaround in sencha touch 2.0 for parsing XML directly at a given rootProperty?

    Thanks in advance,
    Beo Lutz

  2. #2
    Sencha User
    Join Date
    Feb 2012
    Posts
    255
    Vote Rating
    2
    Answers
    6
    landed is on a distinguished road

      1  

    Cool


    make a new class and as a static you can set up functions to hit like data proxy class
    then you can have an example like
    Code:
    getChartData:function(uarehell,callback,scope,filters){     
    		Ext.Ajax.request({
    			url:uarehell,
    			success: function(response, opts) {
    				var data=[];
    				var xml=response.responseXML;
    			
    				var elements=Ext.DomQuery.select('point',xml);
    				
    				 for (var i = 0; i < elements.length; i++) {
    					
    					 var point = elements[i];
    					 var price=Ext.DomQuery.select('price',point);
    
    
    					 data.push(price[0].firstChild.nodeValue);
    					 }
    				callback(data,scope);
    				}
    			})
    		
    		}

  3. #3
    Sencha Premium Member
    Join Date
    Feb 2012
    Posts
    9
    Vote Rating
    0
    clippernet is on a distinguished road

      0  

    Default


    That's it! Thanks!

Thread Participants: 1