View Full Version : problem in accessing store data using XmlReader

24 Apr 2008, 3:37 AM
Hi All,

I am getting the XML data from server using store and XmlReader. But after loaded the data, if i try to get the data from store, i couldn't able to get the records. In callback, it returns always blank record array. Also my content type is application/xml. Please find my below code snippet.

var loadedDevs = Ext.data.Record.create([
{name: 'deviceaddress', type: 'string'}

var devsStore = new Ext.data.Store({
url: 'devices.xml',
reader: new Ext.data.XmlReader({
record: 'loadedDevs',
totalRecords: 'totalDevices'
}, [
{name: 'deviceaddress', mapping: 'deviceaddress'}
sortInfo:{field:'deviceaddress', direction:'ASC'}

devsStore.load({callback:function(r, options, success){console.log('callback::' + r);}, scope:this});

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceaddress id="1001"></deviceaddress>
<deviceaddress id="1002"></deviceaddress>

Thanks in advance.


24 Apr 2008, 4:00 AM

record: 'loadedDevs',

means that you have

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceaddress id="1"></deviceaddress>
<deviceaddress id="2"></deviceaddress>

Obviously, you can't have all your fields at the same level in your XML document. Each one is a field of a different record

Tony Mariella
24 Apr 2008, 4:01 AM
Either your
record: 'loadedDevs' need to change to
record: 'dev'
or your xml need to change from dev to loadedDevs

24 Apr 2008, 4:03 AM
That's not it. <dev> is not a repeating element representing each individual record. He needs to separate his records out.