0

我试图解析这种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>

使用此代码:

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();

我不知道原因,但我什至无法解析第一个 alert() 没有显示。

请帮忙.....

4

1 回答 1

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

大写 M - Javascript 区分大小写

于 2011-01-19T03:38:21.610 回答