View Full Version : Problem reading success attribute on store using xml reader

16 Aug 2010, 2:25 AM
Earlier I posted something I think is a bug for forms using xml readers
Ext.data.XmlReader-on-forms-messageProperty-NOT-used (http://www.sencha.com/forum/showthread.php?107202-Ext.data.XmlReader-on-forms-messageProperty-NOT-used)

Now I have a similar issue using an XmlReader in a store. I am posting here since I'm not so sure this is a bug or my

var store = new Ext.data.Store({
autoLoad: false,
reader: new Ext.data.XmlReader({
success: "@success",
record: "rec"
},['login'] ),
url: 'test1.xml'

callback: function(r,options,success) {
if (success)
Ext.Msg.alert('Success', "xa");
Ext.Msg.alert('Failure', "xaF");

Here is the test1.xml

<?xml version="1.0" encoding="UTF-8"?>
<message success="false">

When success="true" everything is fine, but when success="false" then I get an error at the last return command in

function attrValue(n, attr){
if(!n.tagName && typeof n.length != "undefined"){
n = n[0];
return null;
if(attr == "for"){
return n.htmlFor;
if(attr == "class" || attr == "className"){
return n.className;
return n.getAttribute(attr) || n[attr];

I found that in the onRead function of the HTTPProxy if success === false then
the reader's readResponce is called and it seems to have a problem of the getting the xml attributes.
I think is setting the wrong root xml document

onRead : function(action, o, response) {
var result;
try {
result = o.reader.read(response);

this.fireEvent('loadexception', this, o, response, e);

this.fireEvent('exception', this, 'response', action, o, response, e);
o.request.callback.call(o.reque.scope, null, o.request.arg, false);
if (result.success === false) {
this.fireEvent('loadexception', this, o, response);
var res = o.reader.readResponse(action, response);
this.fireEvent('exception', this, 'remote', action, o, res, null);
else {
this.fireEvent('load', this, o, o.request.arg);
o.request.callback.call(o.request.scope, result, o.request.arg, result.success);

Any thoughts would be much appreciated, :)