如何解析这种格式的xml数据呢?
我尝试解析这种 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();
我不知道原因,但我无法解析,即使第一个警报()没有显示。
请帮忙......
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.....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
大写 M - Javascript 区分大小写
Capital M - Javascript is case sensitive