X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6e39d509471fe9b4e2660e0d1631b350d0c66f40..6b044c28b5f26fb99c86c237ffad19741c0f7f3d:/docs/source/XmlReader.html?ds=sidebyside diff --git a/docs/source/XmlReader.html b/docs/source/XmlReader.html index 2042f608..3c94e27a 100644 --- a/docs/source/XmlReader.html +++ b/docs/source/XmlReader.html @@ -1,12 +1,18 @@ - -
- -/** + + + ++ \ No newline at end of fileThe source code + + + + +/*! + * Ext JS Library 3.3.1 + * Copyright(c) 2006-2010 Sencha Inc. + * licensing@sencha.com + * http://www.sencha.com/license + */ +/** * @class Ext.data.XmlReader * @extends Ext.data.DataReader *- +});Data reader class to create an Array of {@link Ext.data.Record} objects from an XML document @@ -121,21 +127,22 @@ Ext.extend(Ext.data.XmlReader, Ext.data.DataReader, { }, /** - * Decode a json response from server. + * Decode an XML response from server. * @param {String} action [{@link Ext.data.Api#actions} create|read|update|destroy] * @param {Object} response HTTP Response object from browser. - * @return {Ext.data.Response} response Returns an instance of {@link Ext.data.Response} + * @return {Ext.data.Response} An instance of {@link Ext.data.Response} */ readResponse : function(action, response) { - var q = Ext.DomQuery, - doc = response.responseXML; + var q = Ext.DomQuery, + doc = response.responseXML, + root = doc.documentElement || doc; // create general Response instance. var res = new Ext.data.Response({ action: action, - success : this.getSuccess(doc), - message: this.getMessage(doc), - data: this.extractData(q.select(this.meta.record, doc) || q.select(this.meta.root, doc), false), + success : this.getSuccess(root), + message: this.getMessage(root), + data: this.extractData(q.select(this.meta.record, root) || q.select(this.meta.root, root), false), raw: doc }); @@ -186,7 +193,7 @@ Ext.extend(Ext.data.XmlReader, Ext.data.DataReader, { } this.getRoot = function(res) { return (!Ext.isEmpty(res[this.meta.record])) ? res[this.meta.record] : res[this.meta.root]; - } + }; if (s.idPath || s.idProperty) { var g = this.createAccessor(s.idPath || s.idProperty); this.getId = function(rec) { @@ -215,23 +222,26 @@ Ext.extend(Ext.data.XmlReader, Ext.data.DataReader, { createAccessor : function(){ var q = Ext.DomQuery; return function(key) { + if (Ext.isFunction(key)) { + return key; + } switch(key) { case this.meta.totalProperty: return function(root, def){ return q.selectNumber(key, root, def); - } + }; break; case this.meta.successProperty: return function(root, def) { var sv = q.selectValue(key, root, true); var success = sv !== false && sv !== 'false'; return success; - } + }; break; default: return function(root, def) { return q.selectValue(key, root, def); - } + }; break; } }; @@ -254,6 +264,6 @@ Ext.extend(Ext.data.XmlReader, Ext.data.DataReader, { } return values; } -});