我想用煎茶觸摸解析XML,我已經試過在stckovrflow所有的可能性,但沒有任何的顯示:解析XML 2
XML數據: 來自:http://www.aufaitmaroc.com/feeds/maroc.xml
商店:
Ext.define("MyApp2.store.NewsStore", {
extend: "Ext.data.Store",
requires: ["Ext.data.proxy.JsonP", "Ext.dataview.List", "MyApp2.model.News" ,"Ext.data.reader.Xml"],
config: {
model: "MyApp2.model.News",
autoLoad: true,
proxy: {
type: 'jsonp',
url: 'http://www.aufaitmaroc.com/feeds/maroc.xml',
reader: {
type: 'xml',
record: 'item',
rootProperty: 'channel'
}
}
}
});
我的模型:
Ext.define("MyApp2.model.News", {
extend: "Ext.data.Model",
config: {
type:'tree',
fields: [
{name: 'title', type: 'auto'}
]
}
});
我的觀點:
{
xtype: "list",
store: "NewsStore",
itemTpl: '<h1>{title}</h1>'
}
我在鍍鉻的控制檯這樣的錯誤:
我試圖解決我的問題: 我在httpd.conf中的添加此阿帕奇(IM使用WampServer)
AddType application/x-font-woff .woff
AddType application/rss+xml .xml
和我創建:的httpd-proxy.conf並把它額外的文件夾
我的httpd-proxy.conf
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /EMBackend http://localhost:8383/MyApp2/index.html
ProxyPassReverse /EMBackend http://localhost:8383/MyApp2/index.html
<Location /EMBackend>
Order allow,deny
Allow from all
</Location>
我有這個到httpd.conf:
Include conf/extra/httpd-proxy.conf
&還是老樣子無法顯示任何數據。任何幫助將不勝感激:)
PS:我嘗試使用JSONP那樣:
proxy: {
type: 'jsonp',
url: 'https://ajax.googleapis.com/ajax/services/feed/load? v=1.0&q=http://www.aufaitmaroc.com/feeds/maroc.xml',
reader: {
type: 'json',
rootProperty: 'responseData.feed.entries'
}
}
我沒有得到所有的數據,你可以嘗試把你的瀏覽器中的網址。
謝謝你回答,但我是新的js,我沒有得到如何以及我在哪裏必須把我的網址(http://www.aufaitmaroc.com/feeds/maroc.xml)爲了轉換爲json? –
我已經更新了關於YQL的答案。 – blessenm
謝謝你,它工作正常!我的救星! –