我的xml文件是:
<?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>
<event>Weeklies Expiry</event>
</events>
<prices>
<price>0.05</price>
<price>0.5</price>
<price>1</price>
<price>1</price>
<price>22</price>
<price>100.34</price>
</prices>
</root>
我的 ExtJS 代码是:
Ext.regModel('Card', {
fields: ['investor','event','price']
});
var store = new Ext.data.Store({
model: 'Card',
proxy: {
type: 'ajax',
url: 'http:/.../initpicker.php',
reader: {
type: 'xml',
record: 'root'
}
},
listeners: {
single: true,
datachanged: function(){
var items = [];
store.each(function(r){
stocks.push({text: '<span style="color:Blue;font-weight:bolder;font-size:30px;">'+ r.get('price') +'</span>'});
values.push({text: '<span style="font-weight: bold;font-size:25px;">'+ r.get('investor') +'</span>'});
points.push({text: '<span style="font-weight: bold;font-size:25px;">'+ r.get('event') +'</span>'});
});
}
}
});
store.read();
我的问题是,如果我的 xml 包含五次相同的标签,我们仍然可以解析数据。. . . .?
我试过这段代码,但它只解析了第一个............
如果有其他方法请建议。. .
谢谢你。