Prateek Raj
Prateek Raj

Reputation: 3996

How to parse this format of xml data?

i tried to parse data of this format of xml:

<?xml version="1.0" encoding="UTF-8"?> 
<root>
<list info="INFY, Jan 20 call, 40 cents or Lower" profit="60%" loss="gdh"/>
<list info="HPCL, Feb 20 PUT, 20 cents or Lower" profit="80%" loss="fgh"/>
<list info="AAPL, May 290 call, 90 cents or Lower" profit="ss" loss="20%"/>
<list info="DIA, April 105 call, 32 cents or Lower" profit="ghh" loss="20%"/>
<list info="GOOG, Aug 350 call, 47 cents or Lower" profit="100%" loss="sdgd"/>
</root>

using this code:

Ext.regmodel('picks',{fields: ['info','profit','loss']});
alert();
var pickstore = new Ext.data.store({
                                    model: 'picks',
                                    proxy: {
                                            type: 'ajax',
                                            url: 'http://1........ksxml.xml',   //url is fine it's good and working..
                                            reader: {
                                                     type: 'xml',
                                                     record: 'list'
                                                    }
                                            },
                                    listeners: {
                                                single: true,
                                                datachanged: function(){
                                                                        pickstore.each(function(pr){
                                                                                        alert(pr.get('@info'));
                                                                                       });
                                                                        }
                                                }       
                                   });

pickstore.read();

i donno wats the reason but i couldnt parse even the first alert() is not displaying.

please help.....

Upvotes: 0

Views: 1222

Answers (1)

bensiu
bensiu

Reputation: 25604

Ext.regModel( 'picks' ......

Capital M - Javascript is case sensitive

Upvotes: 0

Related Questions