View Full Version : MVC and reading XML data

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.

XML data not found in the response, ext-debug.js:8077


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'


Ext.define('AM.model.User', {
extend: 'Ext.data.Model',
fields: ['id', 'name', 'email']


<?xml version="1.0" encoding="UTF-8"?>
<email>[email protected]</email>
<email>[email protected]</email>

How would I get this account manager app to work with an XML file?

Thanks in advance.

24 Aug 2011, 9:16 AM
1. Use CODE tags next time you post sample code.

2. What is the content-type of the response coming from the server? Is it "text/xml" or "application/xml"?

From the API docs on Ext.data.reader.Xml:

Note: in order for the browser to parse a returned XML document, the Content-Type header in the HTTP response must be set to "text/xml" or "application/xml". This is very important - the XmlReader will not work correctly otherwise.

27 Aug 2011, 12:09 AM
Your XML is invalid. The first tag (success) must not close until the end of the XML. Try moving the success tag inside your users tag.