Upgrade to ExtJS 4.0.2 - Released 06/09/2011
[extjs.git] / docs / output / Ext.data.reader.Xml.js
1 Ext.data.JsonP.Ext_data_reader_Xml({
2   "allMixins": [
3
4   ],
5   "deprecated": null,
6   "docauthor": null,
7   "members": {
8     "cfg": [
9       {
10         "type": "String",
11         "deprecated": null,
12         "alias": null,
13         "protected": false,
14         "tagname": "cfg",
15         "href": "Reader.html#Ext-data-reader-Reader-cfg-idProperty",
16         "shortDoc": "Name of the property within a row object\nthat contains a record identifier value. ...",
17         "static": false,
18         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js",
19         "private": false,
20         "name": "idProperty",
21         "owner": "Ext.data.reader.Reader",
22         "doc": "<p>Name of the property within a row object\nthat contains a record identifier value.  Defaults to <tt>The id of the model</tt>.\nIf an idProperty is explicitly specified it will override that of the one specified\non the model</p>\n",
23         "linenr": 151,
24         "html_filename": "Reader.html"
25       },
26       {
27         "type": "Boolean",
28         "deprecated": null,
29         "alias": null,
30         "protected": false,
31         "tagname": "cfg",
32         "href": "Reader.html#Ext-data-reader-Reader-cfg-implicitIncludes",
33         "shortDoc": "True to automatically parse models nested within other models in a response\nobject. ...",
34         "static": false,
35         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js",
36         "private": false,
37         "name": "implicitIncludes",
38         "owner": "Ext.data.reader.Reader",
39         "doc": "<p>True to automatically parse models nested within other models in a response\nobject. See the <a href=\"#/api/Ext.data.reader.Reader\" rel=\"Ext.data.reader.Reader\" class=\"docClass\">Ext.data.reader.Reader</a> intro docs for full explanation. Defaults to true.</p>\n",
40         "linenr": 188,
41         "html_filename": "Reader.html"
42       },
43       {
44         "type": "String",
45         "deprecated": null,
46         "alias": null,
47         "protected": false,
48         "tagname": "cfg",
49         "href": "Reader.html#Ext-data-reader-Reader-cfg-messageProperty",
50         "shortDoc": "The name of the property which contains a response message. ...",
51         "static": false,
52         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js",
53         "private": false,
54         "name": "messageProperty",
55         "owner": "Ext.data.reader.Reader",
56         "doc": "<p>The name of the property which contains a response message.\nThis property is optional.</p>\n",
57         "linenr": 183,
58         "html_filename": "Reader.html"
59       },
60       {
61         "type": "String",
62         "deprecated": null,
63         "alias": null,
64         "protected": false,
65         "tagname": "cfg",
66         "href": "Xml.html#Ext-data-reader-Xml-cfg-record",
67         "static": false,
68         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Xml.js",
69         "private": false,
70         "name": "record",
71         "owner": "Ext.data.reader.Xml",
72         "doc": "<p>The DomQuery path to the repeated element which contains record information.</p>\n",
73         "linenr": 171,
74         "html_filename": "Xml.html"
75       },
76       {
77         "type": "String",
78         "deprecated": null,
79         "alias": null,
80         "protected": false,
81         "tagname": "cfg",
82         "href": "Reader.html#Ext-data-reader-Reader-cfg-root",
83         "shortDoc": "Required. ...",
84         "static": false,
85         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js",
86         "private": false,
87         "name": "root",
88         "owner": "Ext.data.reader.Reader",
89         "doc": "<p><b>Required</b>.  The name of the property\nwhich contains the Array of row objects.  Defaults to <tt>undefined</tt>.\nAn exception will be thrown if the root property is undefined. The data\npacket value for this property should be an empty array to clear the data\nor show no data.</p>\n",
90         "linenr": 174,
91         "html_filename": "Reader.html"
92       },
93       {
94         "type": "String",
95         "deprecated": null,
96         "alias": null,
97         "protected": false,
98         "tagname": "cfg",
99         "href": "Reader.html#Ext-data-reader-Reader-cfg-successProperty",
100         "shortDoc": "Name of the property from which to\nretrieve the success attribute. ...",
101         "static": false,
102         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js",
103         "private": false,
104         "name": "successProperty",
105         "owner": "Ext.data.reader.Reader",
106         "doc": "<p>Name of the property from which to\nretrieve the success attribute. Defaults to <tt>success</tt>.  See\n<a href=\"#/api/Ext.data.proxy.Proxy\" rel=\"Ext.data.proxy.Proxy\" class=\"docClass\">Ext.data.proxy.Proxy</a>.exception\nfor additional information.</p>\n",
107         "linenr": 166,
108         "html_filename": "Reader.html"
109       },
110       {
111         "type": "String",
112         "deprecated": null,
113         "alias": null,
114         "protected": false,
115         "tagname": "cfg",
116         "href": "Reader.html#Ext-data-reader-Reader-cfg-totalProperty",
117         "shortDoc": "Name of the property from which to\nretrieve the total number of records in the dataset. ...",
118         "static": false,
119         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js",
120         "private": false,
121         "name": "totalProperty",
122         "owner": "Ext.data.reader.Reader",
123         "doc": "<p>Name of the property from which to\nretrieve the total number of records in the dataset. This is only needed\nif the whole dataset is not passed in one go, but is being paged from\nthe remote server.  Defaults to <tt>total</tt>.</p>\n",
124         "linenr": 158,
125         "html_filename": "Reader.html"
126       }
127     ],
128     "method": [
129       {
130         "deprecated": null,
131         "alias": null,
132         "href": "Reader.html#Ext-data-reader-Reader-method-constructor",
133         "tagname": "method",
134         "protected": false,
135         "shortDoc": "Creates new Reader. ...",
136         "static": false,
137         "params": [
138           {
139             "type": "Object",
140             "optional": true,
141             "doc": "<p>(optional) Config object.</p>\n",
142             "name": "config"
143           }
144         ],
145         "private": false,
146         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js",
147         "doc": "<p>Creates new Reader.</p>\n",
148         "owner": "Ext.data.reader.Reader",
149         "name": "Xml",
150         "html_filename": "Reader.html",
151         "return": {
152           "type": "Object",
153           "doc": "\n"
154         },
155         "linenr": 196
156       },
157       {
158         "deprecated": null,
159         "alias": null,
160         "protected": false,
161         "tagname": "method",
162         "href": "Xml.html#Ext-data-reader-Xml-method-getData",
163         "shortDoc": "Normalizes the data object ...",
164         "static": false,
165         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Xml.js",
166         "private": false,
167         "params": [
168           {
169             "type": "Object",
170             "optional": false,
171             "doc": "<p>The raw data object</p>\n",
172             "name": "data"
173           }
174         ],
175         "name": "getData",
176         "owner": "Ext.data.reader.Xml",
177         "doc": "<p>Normalizes the data object</p>\n",
178         "linenr": 221,
179         "return": {
180           "type": "Object",
181           "doc": "<p>Returns the documentElement property of the data object if present, or the same object if not</p>\n"
182         },
183         "html_filename": "Xml.html"
184       },
185       {
186         "deprecated": null,
187         "alias": null,
188         "protected": false,
189         "tagname": "method",
190         "href": "Reader.html#Ext-data-reader-Reader-method-getResponseData",
191         "shortDoc": "Takes a raw response object (as passed to this.read) and returns the useful data segment of it. ...",
192         "static": false,
193         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js",
194         "private": false,
195         "params": [
196           {
197             "type": "Object",
198             "optional": false,
199             "doc": "<p>The responce object</p>\n",
200             "name": "response"
201           }
202         ],
203         "name": "getResponseData",
204         "owner": "Ext.data.reader.Reader",
205         "doc": "<p>Takes a raw response object (as passed to this.read) and returns the useful data segment of it. This must be implemented by each subclass</p>\n",
206         "linenr": 460,
207         "return": {
208           "type": "Object",
209           "doc": "<p>The useful data from the response</p>\n"
210         },
211         "html_filename": "Reader.html"
212       },
213       {
214         "deprecated": null,
215         "alias": null,
216         "protected": false,
217         "tagname": "method",
218         "href": "Reader.html#Ext-data-reader-Reader-method-read",
219         "shortDoc": "Reads the given response object. ...",
220         "static": false,
221         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js",
222         "private": false,
223         "params": [
224           {
225             "type": "Object",
226             "optional": false,
227             "doc": "<p>The response object. This may be either an XMLHttpRequest object or a plain JS object</p>\n",
228             "name": "response"
229           }
230         ],
231         "name": "read",
232         "owner": "Ext.data.reader.Reader",
233         "doc": "<p>Reads the given response object. This method normalizes the different types of response object that may be passed\nto it, before handing off the reading of records to the <a href=\"#/api/Ext.data.reader.Xml-method-readRecords\" rel=\"Ext.data.reader.Xml-method-readRecords\" class=\"docClass\">readRecords</a> function.</p>\n",
234         "linenr": 228,
235         "return": {
236           "type": "Ext.data.ResultSet",
237           "doc": "<p>The parsed ResultSet object</p>\n"
238         },
239         "html_filename": "Reader.html"
240       },
241       {
242         "deprecated": null,
243         "alias": null,
244         "protected": false,
245         "tagname": "method",
246         "href": "Xml.html#Ext-data-reader-Xml-method-readRecords",
247         "shortDoc": "Parses an XML document and returns a ResultSet containing the model instances ...",
248         "static": false,
249         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Xml.js",
250         "private": false,
251         "params": [
252           {
253             "type": "Object",
254             "optional": false,
255             "doc": "<p>Parsed XML document</p>\n",
256             "name": "doc"
257           }
258         ],
259         "name": "readRecords",
260         "owner": "Ext.data.reader.Xml",
261         "doc": "<p>Parses an XML document and returns a ResultSet containing the model instances</p>\n",
262         "linenr": 284,
263         "return": {
264           "type": "Ext.data.ResultSet",
265           "doc": "<p>The parsed result set</p>\n"
266         },
267         "html_filename": "Xml.html"
268       }
269     ],
270     "property": [
271       {
272         "type": "Mixed",
273         "deprecated": null,
274         "alias": null,
275         "protected": false,
276         "tagname": "property",
277         "href": "Reader.html#Ext-data-reader-Reader-property-rawData",
278         "shortDoc": "The raw data object that was last passed to readRecords. ...",
279         "static": false,
280         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Reader.js",
281         "private": false,
282         "name": "rawData",
283         "owner": "Ext.data.reader.Reader",
284         "doc": "<p>The raw data object that was last passed to readRecords. Stored for further processing if needed</p>\n",
285         "linenr": 268,
286         "html_filename": "Reader.html"
287       },
288       {
289         "type": "Object",
290         "deprecated": null,
291         "alias": null,
292         "protected": false,
293         "tagname": "property",
294         "href": "Xml.html#Ext-data-reader-Xml-property-xmlData",
295         "shortDoc": "DEPRECATED - will be removed in Ext JS 5.0. ...",
296         "static": false,
297         "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Xml.js",
298         "private": false,
299         "name": "xmlData",
300         "owner": "Ext.data.reader.Xml",
301         "doc": "<p>DEPRECATED - will be removed in <a href=\"#/api/Ext\" rel=\"Ext\" class=\"docClass\">Ext</a> JS 5.0. This is just a copy of this.rawData - use that instead</p>\n",
302         "linenr": 295,
303         "html_filename": "Xml.html"
304       }
305     ],
306     "cssVar": [
307
308     ],
309     "cssMixin": [
310
311     ],
312     "event": [
313
314     ]
315   },
316   "singleton": false,
317   "alias": null,
318   "superclasses": [
319     "Ext.data.reader.Reader"
320   ],
321   "protected": false,
322   "tagname": "class",
323   "mixins": [
324
325   ],
326   "href": "Xml.html#Ext-data-reader-Xml",
327   "subclasses": [
328
329   ],
330   "static": false,
331   "author": "Ed Spencer",
332   "component": false,
333   "filename": "/mnt/ebs/nightly/git/SDK/platform/src/data/reader/Xml.js",
334   "private": false,
335   "alternateClassNames": [
336     "Ext.data.XmlReader"
337   ],
338   "name": "Ext.data.reader.Xml",
339   "doc": "<p>The XML Reader is used by a Proxy to read a server response that is sent back in XML format. This usually\nhappens as a result of loading a Store - for example we might create something like this:</p>\n\n\n\n\n<pre><code>Ext.define('User', {\n    extend: 'Ext.data.Model',\n    fields: ['id', 'name', 'email']\n});\n\nvar store = new Ext.data.Store({\n    model: 'User',\n    proxy: {\n        type: 'ajax',\n        url : 'users.xml',\n        reader: {\n            type: 'xml',\n            record: 'user'\n        }\n    }\n});\n</code></pre>\n\n\n\n\n<p>The example above creates a 'User' model. Models are explained in the <a href=\"#/api/Ext.data.Model\" rel=\"Ext.data.Model\" class=\"docClass\">Model</a> docs if you're\nnot already familiar with them.</p>\n\n\n\n\n<p>We created the simplest type of XML Reader possible by simply telling our <a href=\"#/api/Ext.data.Store\" rel=\"Ext.data.Store\" class=\"docClass\">Store</a>'s \n<a href=\"#/api/Ext.data.proxy.Proxy\" rel=\"Ext.data.proxy.Proxy\" class=\"docClass\">Proxy</a> that we want a XML Reader. The Store automatically passes the configured model to the\nStore, so it is as if we passed this instead:\n\n<pre><code>reader: {\n    type : 'xml',\n    model: 'User',\n    record: 'user'\n}\n</code></pre>\n\n<p>The reader we set up is ready to read data from our server - at the moment it will accept a response like this:</p>\n\n<pre><code>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n&lt;user&gt;\n    &lt;id&gt;1&lt;/id&gt;\n    &lt;name&gt;Ed Spencer&lt;/name&gt;\n    &lt;email&gt;ed@sencha.com&lt;/email&gt;\n&lt;/user&gt;\n&lt;user&gt;\n    &lt;id&gt;2&lt;/id&gt;\n    &lt;name&gt;Abe Elias&lt;/name&gt;\n    &lt;email&gt;abe@sencha.com&lt;/email&gt;\n&lt;/user&gt;\n</code></pre>\n\n<p>The XML Reader uses the configured <a href=\"#/api/Ext.data.reader.Xml-cfg-record\" rel=\"Ext.data.reader.Xml-cfg-record\" class=\"docClass\">record</a> option to pull out the data for each record - in this case we\nset record to 'user', so each &lt;user&gt; above will be converted into a User model.</p>\n\n<p><u>Reading other XML formats</u></p>\n\n<p>If you already have your XML format defined and it doesn't look quite like what we have above, you can usually\npass XmlReader a couple of configuration options to make it parse your format. For example, we can use the \n<a href=\"#/api/Ext.data.reader.Xml-cfg-root\" rel=\"Ext.data.reader.Xml-cfg-root\" class=\"docClass\">root</a> configuration to parse data that comes back like this:</p>\n\n<pre><code>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n&lt;users&gt;\n    &lt;user&gt;\n        &lt;id&gt;1&lt;/id&gt;\n        &lt;name&gt;Ed Spencer&lt;/name&gt;\n        &lt;email&gt;ed@sencha.com&lt;/email&gt;\n    &lt;/user&gt;\n    &lt;user&gt;\n        &lt;id&gt;2&lt;/id&gt;\n        &lt;name&gt;Abe Elias&lt;/name&gt;\n        &lt;email&gt;abe@sencha.com&lt;/email&gt;\n    &lt;/user&gt;\n&lt;/users&gt;\n</code></pre>\n\n<p>To parse this we just pass in a <a href=\"#/api/Ext.data.reader.Xml-cfg-root\" rel=\"Ext.data.reader.Xml-cfg-root\" class=\"docClass\">root</a> configuration that matches the 'users' above:</p>\n\n<pre><code>reader: {\n    type  : 'xml',\n    root  : 'users',\n    record: 'user'\n}\n</code></pre>\n\n<p>Note that XmlReader doesn't care whether your <a href=\"#/api/Ext.data.reader.Xml-cfg-root\" rel=\"Ext.data.reader.Xml-cfg-root\" class=\"docClass\">root</a> and <a href=\"#/api/Ext.data.reader.Xml-cfg-record\" rel=\"Ext.data.reader.Xml-cfg-record\" class=\"docClass\">record</a> elements are nested deep inside\na larger structure, so a response like this will still work:\n\n<pre><code>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n&lt;deeply&gt;\n    &lt;nested&gt;\n        &lt;xml&gt;\n            &lt;users&gt;\n                &lt;user&gt;\n                    &lt;id&gt;1&lt;/id&gt;\n                    &lt;name&gt;Ed Spencer&lt;/name&gt;\n                    &lt;email&gt;ed@sencha.com&lt;/email&gt;\n                &lt;/user&gt;\n                &lt;user&gt;\n                    &lt;id&gt;2&lt;/id&gt;\n                    &lt;name&gt;Abe Elias&lt;/name&gt;\n                    &lt;email&gt;abe@sencha.com&lt;/email&gt;\n                &lt;/user&gt;\n            &lt;/users&gt;\n        &lt;/xml&gt;\n    &lt;/nested&gt;\n&lt;/deeply&gt;\n</code></pre>\n\n<p><u>Response metadata</u></p>\n\n<p>The server can return additional data in its response, such as the <a href=\"#/api/Ext.data.reader.Xml-cfg-totalProperty\" rel=\"Ext.data.reader.Xml-cfg-totalProperty\" class=\"docClass\">total number of records</a> \nand the <a href=\"#/api/Ext.data.reader.Xml-cfg-successProperty\" rel=\"Ext.data.reader.Xml-cfg-successProperty\" class=\"docClass\">success status of the response</a>. These are typically included in the XML response\nlike this:</p>\n\n<pre><code>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n&lt;total&gt;100&lt;/total&gt;\n&lt;success&gt;true&lt;/success&gt;\n&lt;users&gt;\n    &lt;user&gt;\n        &lt;id&gt;1&lt;/id&gt;\n        &lt;name&gt;Ed Spencer&lt;/name&gt;\n        &lt;email&gt;ed@sencha.com&lt;/email&gt;\n    &lt;/user&gt;\n    &lt;user&gt;\n        &lt;id&gt;2&lt;/id&gt;\n        &lt;name&gt;Abe Elias&lt;/name&gt;\n        &lt;email&gt;abe@sencha.com&lt;/email&gt;\n    &lt;/user&gt;\n&lt;/users&gt;\n</code></pre>\n\n<p>If these properties are present in the XML response they can be parsed out by the XmlReader and used by the\nStore that loaded it. We can set up the names of these properties by specifying a final pair of configuration \noptions:</p>\n\n<pre><code>reader: {\n    type: 'xml',\n    root: 'users',\n    totalProperty  : 'total',\n    successProperty: 'success'\n}\n</code></pre>\n\n<p>These final options are not necessary to make the Reader work, but can be useful when the server needs to report\nan error or if it needs to indicate that there is a lot of data available of which only a subset is currently being\nreturned.</p>\n\n<p><u>Response format</u></p>\n\n<p><b>Note:</b> in order for the browser to parse a returned XML document, the Content-Type header in the HTTP \nresponse must be set to \"text/xml\" or \"application/xml\". This is very important - the XmlReader will not\nwork correctly otherwise.</p>\n\n",
340   "mixedInto": [
341
342   ],
343   "linenr": 1,
344   "xtypes": [
345
346   ],
347   "html_filename": "Xml.html",
348   "extends": "Ext.data.reader.Reader"
349 });