您好,我是使用 sencha 开发移动应用程序的新手。在我在这里发布之前,我已经在谷歌上进行了研究,但我没有找到任何解决方案。我正在尝试从具有以下格式的 xml 中获取数据
<?xml version="1.0" encoding="UTF-8"?>
<rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
>
<channel>
<title></title>
<link></link>
<description></description>
<language>en-us</language>
<pubDate>Mon, 08 Jul 2013 13:12:39 +0000</pubDate>
<lastBuildDate>Mon, 08 Jul 2013 13:12:39 +0000</lastBuildDate>
<managingEditor></managingEditor>
<item>
<position>1</position>
<image>img/2.png</image>
<name>Sun</name>
<small_desciption>dfsfsdfsdf</small_desciption>
</item>
<item>
<position>2</position>
<image>img/2.png</image>
<name>Hot</name>
<small_desciption>fsdfdsfsdf</small_desciption>
</item>
........
</channel>
</rss>
这是我的代码
Ext.regModel('test', {
fields: [{
name: 'image',
type: 'string'
}, {
name: 'name',
type: 'string'
}, {
name: 'small_desciption',
type: 'string'
}, {
name: 'position',
type: 'string',
}]
});
ToolbarDemo.views.Testtab = Ext.extend(Ext.Panel, {
title: "Test",
iconCls: "test",
styleHtmlContent: true,
style:"background-color:#FFFFFF;",
dockedItems: [
{
xtype: "toolbar",
title: "Test",
items : [
{ xtype : 'spacer' },
// { xtype : 'spacer' },
],
},
],
layout: {
type: 'fit'
},
initComponent: function() {
this.setLoading(true,true);
var proxyUrl = 'http://mydomain/newsfeed/'
var store = new Ext.data.Store({
model: 'test',
proxy: {
type: 'ajax',
url: proxyUrl,
reader: {
type: 'xml',
record: 'item',
}
},
datachanged: function(){
var items = [];
store.each(function(rec){
items.push({
html: [
'<div class="main"><div class="thumb"><div class="contain">{position}</div><div class="image"><img src="http://mydomain/{image}.jpg" width="280" height="100"></div></div><div class="mainentry"><div class="maintitle">{name}</div><div class="description">{small_desciption}</div></div></div>',
]
});
});
}
});
store.read();
ToolbarDemo.views.Testtab.superclass.initComponent.call(this);
} });
Ext.reg('testtab', ToolbarDemo.views.Testtab);
我做错了什么?
谢谢