只有五个组件中的第一个。
Ext.regModel('Card',{ fields:['investor'] }); var store = new Ext.data.Store({ model:'Card', proxy:{ type:'ajax', url:'xmlformat.xml', reader:{ type:'xml', record:'invest'} }, listeners :{ single:true, datachanged:function(){ Ext.getBody()。unmask(); var items = []; store。每个(function(rec){ alert(rec.get('investor')); });,我的xml文件是:
<?xml version = 1.0encoding =UTF-8?> < root> <投资者> <投资者>活动< / investor> <投资者& ; / investor> < investor>保守< / investor> <投资者>日交易者< / investor> < investor> Active< / investor> < / investors> < events> < event> 3个月到期< / event> < event> LEAPS< / event> < event> Monthlies< / event> < event>每月到期< / event> < event> Weeklies< / event> < / events> < price> < price> $ 0.5< / price> < price> $ 0.05< / price> < price> $ 1< / price> < price> $ 22< / price> < price> $ 100.34< / price> < / prices> < / root>wen我只运行代码活动出来。 。 。 。
我知道我做错了,但我不知道什么....
请帮忙 。 。 。 。
解决方案每个事情都很好,我的xml格式应该是这样的:
活动 3个月到期 $ 0.5 进取 LEAPS $ 0.05 保守月份 $ 1 日交易者每月到期 $ 22 非常活跃 Weeklies $ 100.34
<?xml version =1.0encoding =UTF-8?> < main> < root> < investor> Active< / investor> < event> 3个月到期< / event> < price> $ 0.5< / price> < / root> < root> < investor> Aggressive< / investor> < event> LEAPS< / event> < price> $ 0.05< / price> < / root> < root> < investor>保守< / investor> < event> Monthlies< / event> < price> $ 1< / price> < / root> < root> < investor> Day Trader< / investor> < event>每月到期< / event> < price> $ 22< / price> < / root> < root> < investor>非常活跃< / investor> < event> Weeklies< / event> < price> $ 100.34< / price> < / root> < / main>
i'm parsing an xml with my extjs but it returns only one of the five components.
only the first one of the five components.
Ext.regModel('Card', { fields: ['investor'] }); var store = new Ext.data.Store({ model: 'Card', proxy: { type: 'ajax', url: 'xmlformat.xml', reader: { type: 'xml', record: 'investors' } }, listeners: { single: true, datachanged: function(){ Ext.getBody().unmask(); var items = []; store.each(function(rec){ alert(rec.get('investor')); });and my xml file is:
<?xml version="1.0" encoding="UTF-8"?> <root> <investors> <investor>Active</investor> <investor>Aggressive</investor> <investor>Conservative</investor> <investor>Day Trader</investor> <investor>Very Active</investor> </investors> <events> <event>3 Month Expiry</event> <event>LEAPS</event> <event>Monthlies</event> <event>Monthly Expiries</event> <event>Weeklies</event> </events> <prices> <price>$0.5</price> <price>$0.05</price> <price>$1</price> <price>$22</price> <price>$100.34</price> </prices> </root>wen i run the code only "Active" comes out. . . .
i know that i'm doing something wrong but i'm not sure what....
please help . . . . .
解决方案Every thing was fine execpt that my xml format should be like this:
Active 3 Month Expiry $0.5 Aggressive LEAPS $0.05 Conservative Monthlies $1 Day Trader Monthly Expiries $22 Very Active Weeklies $100.34
<?xml version="1.0" encoding="UTF-8"?> <main> <root> <investor>Active</investor> <event>3 Month Expiry</event> <price>$0.5</price> </root> <root> <investor>Aggressive</investor> <event>LEAPS</event> <price>$0.05</price> </root> <root> <investor>Conservative</investor> <event>Monthlies</event> <price>$1</price> </root> <root> <investor>Day Trader</investor> <event>Monthly Expiries</event> <price>$22</price> </root> <root> <investor>Very Active</investor> <event>Weeklies</event> <price>$100.34</price> </root> </main>
更多推荐
我的XML有什么问题吗?
发布评论