jamone
24 Aug 2011, 6:28 AM
MVC and reading XML data
I looked at the MVC account manager demo application in the Application Architecture and appreciated it, and it worked using the json data format, I wanted to switch to an XML data format and get the following error.
Error:
XML data not found in the response, ext-debug.js:8077
app/store/Users.js
Ext.define('AM.store.Users', {
extend: 'Ext.data.Store',
model: 'AM.model.User',
autoLoad: true,
proxy: {
type: 'ajax',
api: {
read: 'data/users.xml',
update: 'data/updateUsers.xml'
},
reader: {
type: 'xml',
root: 'users',
record: 'user',
successProperty: 'success'
}
}
});
app/model/User.js
Ext.define('AM.model.User', {
extend: 'Ext.data.Model',
fields: ['id', 'name', 'email']
});
app/data/users.xml
<?xml version="1.0" encoding="UTF-8"?>
<success>true</success>
<users>
<user>
<id>1</id>
<name>Ed</name>
<email>ed@sencha.com</email>
</user>
<user>
<id>2</id>
<name>Tommy</name>
<email>tommy@sencha.com</email>
</user>
</users>
How would I get this account manager app to work with an XML file?
Thanks in advance.
I looked at the MVC account manager demo application in the Application Architecture and appreciated it, and it worked using the json data format, I wanted to switch to an XML data format and get the following error.
Error:
XML data not found in the response, ext-debug.js:8077
app/store/Users.js
Ext.define('AM.store.Users', {
extend: 'Ext.data.Store',
model: 'AM.model.User',
autoLoad: true,
proxy: {
type: 'ajax',
api: {
read: 'data/users.xml',
update: 'data/updateUsers.xml'
},
reader: {
type: 'xml',
root: 'users',
record: 'user',
successProperty: 'success'
}
}
});
app/model/User.js
Ext.define('AM.model.User', {
extend: 'Ext.data.Model',
fields: ['id', 'name', 'email']
});
app/data/users.xml
<?xml version="1.0" encoding="UTF-8"?>
<success>true</success>
<users>
<user>
<id>1</id>
<name>Ed</name>
<email>ed@sencha.com</email>
</user>
<user>
<id>2</id>
<name>Tommy</name>
<email>tommy@sencha.com</email>
</user>
</users>
How would I get this account manager app to work with an XML file?
Thanks in advance.