PDA

View Full Version : how to use xmlreader



lukeHeather123
27 Sep 2010, 10:30 PM
hi guys,

I'm finding hard to find out how to use the xmlreader. I simply just want to read the xml file and output it. An example would much be appreciated.Thanks.

evant
27 Sep 2010, 10:56 PM
/examples/carousel2

lukeHeather123
28 Sep 2010, 12:45 AM
I'm trying to revise the carousel example with my own set of xml data.

<?xml version="1.0" encoding="UTF-8" ?>
<resp status="ok">
<data>test data</data>
</resp>

My problem is when I change the code to get my xml data, I can't retrieve the data.
Here is the part of the code. Hope this may help.

Ext.regModel('Test', {
fields: ['data','status']
});

var store = new Ext.data.Store({
model: 'Test',
proxy: {
type: 'ajax',
url: 'test.xml',
reader: {
type: 'xml',
record: 'resp'
}
},
listeners: {
single: true,
datachanged: function(){
Ext.getBody().unmask();
var items = [];

store.each(function(rec){
items.push({
html: rec.get('data'),
//cls: 'status' + rec.get('status')
});
});