+++ /dev/null
-<!DOCTYPE html><html><head><title>Ext.data.reader.Xml | Ext JS 4.0 Documentation</title><script type="text/javascript" src="../ext-all.js"></script><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../scrollbars.css" type="text/css"><link rel="stylesheet" href="../docs.css" type="text/css"><link id="styleCss" rel="stylesheet" href="../style.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script><link rel="stylesheet" href="../prettify.css" type="text/css"><!-- link(rel: 'stylesheet', href: req.baseURL + '/css/ext4.css', type: 'text/css')--><link rel="shortcut icon" type="image/ico" href="../favicon.ico"><!--[if IE]>
-<style type="text/css">.head-band { display: none; }
-.header { border: 0; top: 0; left: 0px; background: url(../header.gif) repeat-x; }
-.doc-tab .members .member a.more { background-color: #efefef; }
-</style><link rel="stylesheet" href="/new/css/ie.css" type="text/css"><![endif]-->
-</head><body id="ext-body" class="iScroll"><div id="notice" class="notice">For up to date documentation and features, visit
-<a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a></div><div class="wrapper"><div class="head-band"></div><div class="header"><h2><a href="../index.html">Sencha Documentation</a></h2></div><div id="search"><form><input type="text" placeholder="Search" id="search-field" autocomplete="off" name="q"></form><div id="search-box"></div></div><div id="treePanel"></div><div id="container"><script type="text/javascript">
-
- req = {
- liveURL: '.',
- standAloneMode: true,
- origDocClass: 'Ext.data.reader.Xml',
- docClass: 'Ext.data.reader.Xml',
- docReq: 'Ext.data.reader.Xml',
- version: '4.0',
- baseURL: '.',
- baseDocURL: '.',
- baseProdURL: '.'
- };
-
- clsInfo = {};
-
-
-
-</script>
-
-<script type="text/javascript" src="../search.js"></script>
-<!--script type="text/javascript" src="/new/javascripts/app/examples.js"></script-->
-<script type="text/javascript" src="../class_tree.js"></script>
-<script type="text/javascript" src="../class_doc.js"></script>
-<script type="text/javascript">
- req.source = 'Xml.html#Ext-data.reader.Xml';
- clsInfo = {"methods":["Xml","getData","getResponseData","read","readRecords"],"cfgs":["idProperty","implicitIncludes","messageProperty","record","root","successProperty","totalProperty"],"properties":["rawData","xmlData"],"events":[],"subclasses":[]};
- Ext.onReady(function() {
- Ext.create('Docs.classPanel');
- });
-</script><div id="top-block" class="top-block"><h1 id="clsTitle" class="cls"><a href="../source/Xml.html#Ext-data.reader.Xml" target="_blank">Ext.data.reader.Xml</a></h1></div><div id="docContent"><div id="doc-overview-content"><div class="lft"><pre class="subclasses"><h4>Hierarchy</h4><div class="subclass f"><a href="Ext.data.reader.Reader.html" rel="Ext.data.reader.Reader" class="cls docClass">Ext.data.reader.Reader</a><div class="subclass"><strong>Ext.data.reader.Xml</strong></div></div></pre><p>The XML Reader is used by a Proxy to read a server response that is sent back in XML format. This usually
-happens as a result of loading a Store - for example we might create something like this:</p>
-
-
-
-
-<pre class="prettyprint"><code>Ext.define('User', {
- extend: 'Ext.data.Model',
- fields: ['id', 'name', 'email']
-});
-
-var store = new Ext.data.Store({
- model: 'User',
- proxy: {
- type: 'ajax',
- url : 'users.xml',
- reader: {
- type: 'xml',
- record: 'user'
- }
- }
-});
-</code></pre>
-
-
-
-
-<p>The example above creates a 'User' model. Models are explained in the <a href="Ext.data.Model.html" rel="Ext.data.Model" class="docClass">Model</a> docs if you're
-not already familiar with them.</p>
-
-
-
-
-<p>We created the simplest type of XML Reader possible by simply telling our <a href="Ext.data.Store.html" rel="Ext.data.Store" class="docClass">Store</a>'s
-<a href="Ext.data.proxy.Proxy.html" rel="Ext.data.proxy.Proxy" class="docClass">Proxy</a> that we want a XML Reader. The Store automatically passes the configured model to the
-Store, so it is as if we passed this instead:
-
-<pre class="prettyprint"><code>reader: {
- type : 'xml',
- model: 'User',
- record: 'user'
-}
-</code></pre>
-
-<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>
-
-<pre class="prettyprint"><code><?xml version="1.0" encoding="UTF-8"?>
-<user>
- <id>1</id>
- <name>Ed Spencer</name>
- <email>ed@sencha.com</email>
-</user>
-<user>
- <id>2</id>
- <name>Abe Elias</name>
- <email>abe@sencha.com</email>
-</user>
-</code></pre>
-
-<p>The XML Reader uses the configured <a href="Ext.data.reader.Xml.html#record" rel="Ext.data.reader.Xml#record" class="docClass">record</a> option to pull out the data for each record - in this case we
-set record to 'user', so each <user> above will be converted into a User model.</p>
-
-<p><u>Reading other XML formats</u></p>
-
-<p>If you already have your XML format defined and it doesn't look quite like what we have above, you can usually
-pass XmlReader a couple of configuration options to make it parse your format. For example, we can use the
-<a href="Ext.data.reader.Xml.html#root" rel="Ext.data.reader.Xml#root" class="docClass">root</a> configuration to parse data that comes back like this:</p>
-
-<pre class="prettyprint"><code><?xml version="1.0" encoding="UTF-8"?>
-<users>
- <user>
- <id>1</id>
- <name>Ed Spencer</name>
- <email>ed@sencha.com</email>
- </user>
- <user>
- <id>2</id>
- <name>Abe Elias</name>
- <email>abe@sencha.com</email>
- </user>
-</users>
-</code></pre>
-
-<p>To parse this we just pass in a <a href="Ext.data.reader.Xml.html#root" rel="Ext.data.reader.Xml#root" class="docClass">root</a> configuration that matches the 'users' above:</p>
-
-<pre class="prettyprint"><code>reader: {
- type : 'xml',
- root : 'users',
- record: 'user'
-}
-</code></pre>
-
-<p>Note that XmlReader doesn't care whether your <a href="Ext.data.reader.Xml.html#root" rel="Ext.data.reader.Xml#root" class="docClass">root</a> and <a href="Ext.data.reader.Xml.html#record" rel="Ext.data.reader.Xml#record" class="docClass">record</a> elements are nested deep inside
-a larger structure, so a response like this will still work:
-
-<pre class="prettyprint"><code><?xml version="1.0" encoding="UTF-8"?>
-<deeply>
- <nested>
- <xml>
- <users>
- <user>
- <id>1</id>
- <name>Ed Spencer</name>
- <email>ed@sencha.com</email>
- </user>
- <user>
- <id>2</id>
- <name>Abe Elias</name>
- <email>abe@sencha.com</email>
- </user>
- </users>
- </xml>
- </nested>
-</deeply>
-</code></pre>
-
-<p><u>Response metadata</u></p>
-
-<p>The server can return additional data in its response, such as the <a href="Ext.data.reader.Xml.html#totalProperty" rel="Ext.data.reader.Xml#totalProperty" class="docClass">total number of records</a>
-and the <a href="Ext.data.reader.Xml.html#successProperty" rel="Ext.data.reader.Xml#successProperty" class="docClass">success status of the response</a>. These are typically included in the XML response
-like this:</p>
-
-<pre class="prettyprint"><code><?xml version="1.0" encoding="UTF-8"?>
-<total>100</total>
-<success>true</success>
-<users>
- <user>
- <id>1</id>
- <name>Ed Spencer</name>
- <email>ed@sencha.com</email>
- </user>
- <user>
- <id>2</id>
- <name>Abe Elias</name>
- <email>abe@sencha.com</email>
- </user>
-</users>
-</code></pre>
-
-<p>If these properties are present in the XML response they can be parsed out by the XmlReader and used by the
-Store that loaded it. We can set up the names of these properties by specifying a final pair of configuration
-options:</p>
-
-<pre class="prettyprint"><code>reader: {
- type: 'xml',
- root: 'users',
- totalProperty : 'total',
- successProperty: 'success'
-}
-</code></pre>
-
-<p>These final options are not necessary to make the Reader work, but can be useful when the server needs to report
-an error or if it needs to indicate that there is a lot of data available of which only a subset is currently being
-returned.</p>
-
-<p><u>Response format</u></p>
-
-<p><b>Note:</b> 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.</p>
-
-<div class="members"><div class="m-cfgs"><div class="definedBy">Defined By</div><a name="configs"></a><h3 class="cfg p">Config Options</h3><h4 class="cfgGroup">Other Configs</h4><div id="config-idProperty" class="member f inherited"><a href="Ext.data.reader.Xml.html#config-idProperty" rel="config-idProperty" class="expand more ar"><span> </span></a><div class="title"><div class="meta"><a href="Ext.data.reader.Reader.html" class="definedIn docClass">Ext.data.reader.Reader</a><br/><a href="../source/Reader.html#Ext-data.reader.Reader-cfg-idProperty" class="viewSource">view source</a></div><a name="idProperty"></a><a name="config-idProperty"></a><a href="Ext.data.reader.Xml.html#" rel="config-idProperty" class="cls expand">idProperty</a><span> : String</span></div><div class="description"><div class="short">Name of the property within a row object
-that contains a record identifier value. Defaults to The id of the model.
-I...</div><div class="long"><p>Name of the property within a row object
-that contains a record identifier value. Defaults to <tt>The id of the model</tt>.
-If an idProperty is explicitly specified it will override that of the one specified
-on the model</p>
-</div></div></div><div id="config-implicitIncludes" class="member inherited"><a href="Ext.data.reader.Xml.html#config-implicitIncludes" rel="config-implicitIncludes" class="expand more ar"><span> </span></a><div class="title"><div class="meta"><a href="Ext.data.reader.Reader.html" class="definedIn docClass">Ext.data.reader.Reader</a><br/><a href="../source/Reader.html#Ext-data.reader.Reader-cfg-implicitIncludes" class="viewSource">view source</a></div><a name="implicitIncludes"></a><a name="config-implicitIncludes"></a><a href="Ext.data.reader.Xml.html#" rel="config-implicitIncludes" class="cls expand">implicitIncludes</a><span> : Boolean</span></div><div class="description"><div class="short">True to automatically parse models nested within other models in a response
-object. See the Ext.data.reader.Reader in...</div><div class="long"><p>True to automatically parse models nested within other models in a response
-object. See the <a href="Ext.data.reader.Reader.html" rel="Ext.data.reader.Reader" class="docClass">Ext.data.reader.Reader</a> intro docs for full explanation. Defaults to true.</p>
-</div></div></div><div id="config-messageProperty" class="member inherited"><a href="Ext.data.reader.Xml.html#config-messageProperty" rel="config-messageProperty" class="expand more"><span> </span></a><div class="title"><div class="meta"><a href="Ext.data.reader.Reader.html" class="definedIn docClass">Ext.data.reader.Reader</a><br/><a href="../source/Reader.html#Ext-data.reader.Reader-cfg-messageProperty" class="viewSource">view source</a></div><a name="messageProperty"></a><a name="config-messageProperty"></a><a href="Ext.data.reader.Xml.html#" rel="config-messageProperty" class="cls expand">messageProperty</a><span> : String</span></div><div class="description"><div class="short"><p>The name of the property which contains a response message.
-This property is optional.</p>
-</div><div class="long"><p>The name of the property which contains a response message.
-This property is optional.</p>
-</div></div></div><div id="config-record" class="member ni"><a href="Ext.data.reader.Xml.html#config-record" rel="config-record" class="expand more"><span> </span></a><div class="title"><div class="meta"><a href="Ext.data.reader.Xml.html" class="definedIn docClass">Ext.data.reader.Xml</a><br/><a href="../source/Xml.html#Ext-data.reader.Xml-cfg-record" class="viewSource">view source</a></div><a name="record"></a><a name="config-record"></a><a href="Ext.data.reader.Xml.html#" rel="config-record" class="cls expand">record</a><span> : String</span></div><div class="description"><div class="short"><p>The DomQuery path to the repeated element which contains record information.</p>
-</div><div class="long"><p>The DomQuery path to the repeated element which contains record information.</p>
-</div></div></div><div id="config-root" class="member inherited"><a href="Ext.data.reader.Xml.html#config-root" rel="config-root" class="expand more ar"><span> </span></a><div class="title"><div class="meta"><a href="Ext.data.reader.Reader.html" class="definedIn docClass">Ext.data.reader.Reader</a><br/><a href="../source/Reader.html#Ext-data.reader.Reader-cfg-root" class="viewSource">view source</a></div><a name="root"></a><a name="config-root"></a><a href="Ext.data.reader.Xml.html#" rel="config-root" class="cls expand">root</a><span> : String</span></div><div class="description"><div class="short">Required. The name of the property
-which contains the Array of row objects. Defaults to undefined.
-An exception wil...</div><div class="long"><p><b>Required</b>. The name of the property
-which contains the Array of row objects. Defaults to <tt>undefined</tt>.
-An exception will be thrown if the root property is undefined. The data
-packet value for this property should be an empty array to clear the data
-or show no data.</p>
-</div></div></div><div id="config-successProperty" class="member inherited"><a href="Ext.data.reader.Xml.html#config-successProperty" rel="config-successProperty" class="expand more ar"><span> </span></a><div class="title"><div class="meta"><a href="Ext.data.reader.Reader.html" class="definedIn docClass">Ext.data.reader.Reader</a><br/><a href="../source/Reader.html#Ext-data.reader.Reader-cfg-successProperty" class="viewSource">view source</a></div><a name="successProperty"></a><a name="config-successProperty"></a><a href="Ext.data.reader.Xml.html#" rel="config-successProperty" class="cls expand">successProperty</a><span> : String</span></div><div class="description"><div class="short">Name of the property from which to
-retrieve the success attribute. Defaults to success. See
-Ext.data.proxy.Proxy.exc...</div><div class="long"><p>Name of the property from which to
-retrieve the success attribute. Defaults to <tt>success</tt>. See
-<a href="Ext.data.proxy.Proxy.html" rel="Ext.data.proxy.Proxy" class="docClass">Ext.data.proxy.Proxy</a>.<a href="Ext.data.proxy.Proxy.html#exception" rel="Ext.data.proxy.Proxy#exception" class="docClass">exception</a>
-for additional information.</p>
-</div></div></div><div id="config-totalProperty" class="member inherited"><a href="Ext.data.reader.Xml.html#config-totalProperty" rel="config-totalProperty" class="expand more ar"><span> </span></a><div class="title"><div class="meta"><a href="Ext.data.reader.Reader.html" class="definedIn docClass">Ext.data.reader.Reader</a><br/><a href="../source/Reader.html#Ext-data.reader.Reader-cfg-totalProperty" class="viewSource">view source</a></div><a name="totalProperty"></a><a name="config-totalProperty"></a><a href="Ext.data.reader.Xml.html#" rel="config-totalProperty" class="cls expand">totalProperty</a><span> : String</span></div><div class="description"><div class="short">Name of the property from which to
-retrieve the total number of records in the dataset. This is only needed
-if the wh...</div><div class="long"><p>Name of the property from which to
-retrieve the total number of records in the dataset. This is only needed
-if the whole dataset is not passed in one go, but is being paged from
-the remote server. Defaults to <tt>total</tt>.</p>
-</div></div></div></div><div class="m-properties"><a name="properties"></a><div class="definedBy">Defined By</div><h3 class="prp p">Properties</h3><div id="property-rawData" class="member f inherited"><a href="Ext.data.reader.Xml.html#property-rawData" rel="property-rawData" class="expand more"><span> </span></a><div class="title"><div class="meta"><a href="Ext.data.reader.Reader.html" class="definedIn docClass">Ext.data.reader.Reader</a><br/><a href="../source/Reader.html#Ext-data.reader.Reader-property-rawData" class="viewSource">view source</a></div><a name="rawData"></a><a name="property-rawData"></a><a href="Ext.data.reader.Xml.html#" rel="property-rawData" class="cls expand">rawData</a><span> : Mixed</span></div><div class="description"><div class="short"><p>The raw data object that was last passed to readRecords. Stored for further processing if needed</p>
-</div><div class="long"><p>The raw data object that was last passed to readRecords. Stored for further processing if needed</p>
-</div></div></div><div id="property-xmlData" class="member ni"><a href="Ext.data.reader.Xml.html#property-xmlData" rel="property-xmlData" class="expand more"><span> </span></a><div class="title"><div class="meta"><a href="Ext.data.reader.Xml.html" class="definedIn docClass">Ext.data.reader.Xml</a><br/><a href="../source/Xml.html#Ext-data.reader.Xml-property-xmlData" class="viewSource">view source</a></div><a name="xmlData"></a><a name="property-xmlData"></a><a href="Ext.data.reader.Xml.html#" rel="property-xmlData" class="cls expand">xmlData</a><span> : Object</span></div><div class="description"><div class="short"><p>DEPRECATED - will be removed in <a href="Ext.html" rel="Ext" class="docClass">Ext</a> JS 5.0. This is just a copy of this.rawData - use that instead</p>
-</div><div class="long"><p>DEPRECATED - will be removed in <a href="Ext.html" rel="Ext" class="docClass">Ext</a> JS 5.0. This is just a copy of this.rawData - use that instead</p>
-</div></div></div></div><div class="m-methods"><a name="methods"></a><div class="definedBy">Defined By</div><h3 class="mth p">Methods</h3><div id="method-Xml" class="member f inherited"><a href="Ext.data.reader.Xml.html#method-Xml" rel="method-Xml" class="expand more ar"><span> </span></a><div class="title"><div class="meta"><a href="Ext.data.reader.Reader.html" class="definedIn docClass">Ext.data.reader.Reader</a><br/><a href="../source/Reader.html#Ext-data.reader.Reader-method-constructor" class="viewSource">view source</a></div><a name="Xml"></a><a name="method-Xml"></a><a href="Ext.data.reader.Xml.html#" rel="method-Xml" class="cls expand">Xml</a>(
-<span class="pre">Object config</span>)
- : void</div><div class="description"><div class="short"><p> </p></div><div class="long">
-<h3 class="pa">Parameters</h3><ul><li><span class="pre">config</span> : Object<div class="sub-desc"><p>Optional config object</p>
-</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>
-</li></ul></div></div></div><div id="method-getData" class="member ni"><a href="Ext.data.reader.Xml.html#method-getData" rel="method-getData" class="expand more ar"><span> </span></a><div class="title"><div class="meta"><a href="Ext.data.reader.Xml.html" class="definedIn docClass">Ext.data.reader.Xml</a><br/><a href="../source/Xml.html#Ext-data.reader.Xml-method-getData" class="viewSource">view source</a></div><a name="getData"></a><a name="method-getData"></a><a href="Ext.data.reader.Xml.html#" rel="method-getData" class="cls expand">getData</a>(
-<span class="pre">Object data</span>)
- : Object</div><div class="description"><div class="short"><p>Normalizes the data object</p>
-</div><div class="long"><p>Normalizes the data object</p>
-<h3 class="pa">Parameters</h3><ul><li><span class="pre">data</span> : Object<div class="sub-desc"><p>The raw data object</p>
-</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Object</span> <p>Returns the documentElement property of the data object if present, or the same object if not</p>
-</li></ul></div></div></div><div id="method-getResponseData" class="member inherited"><a href="Ext.data.reader.Xml.html#method-getResponseData" rel="method-getResponseData" class="expand more ar"><span> </span></a><div class="title"><div class="meta"><a href="Ext.data.reader.Reader.html" class="definedIn docClass">Ext.data.reader.Reader</a><br/><a href="../source/Reader.html#Ext-data.reader.Reader-method-getResponseData" class="viewSource">view source</a></div><a name="getResponseData"></a><a name="method-getResponseData"></a><a href="Ext.data.reader.Xml.html#" rel="method-getResponseData" class="cls expand">getResponseData</a>(
-<span class="pre">Object response</span>)
- : Object</div><div class="description"><div class="short">Takes a raw response object (as passed to this.read) and returns the useful data segment of it. This must be implemen...</div><div class="long"><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>
-<h3 class="pa">Parameters</h3><ul><li><span class="pre">response</span> : Object<div class="sub-desc"><p>The responce object</p>
-</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Object</span> <p>The useful data from the response</p>
-</li></ul></div></div></div><div id="method-read" class="member inherited"><a href="Ext.data.reader.Xml.html#method-read" rel="method-read" class="expand more ar"><span> </span></a><div class="title"><div class="meta"><a href="Ext.data.reader.Reader.html" class="definedIn docClass">Ext.data.reader.Reader</a><br/><a href="../source/Reader.html#Ext-data.reader.Reader-method-read" class="viewSource">view source</a></div><a name="read"></a><a name="method-read"></a><a href="Ext.data.reader.Xml.html#" rel="method-read" class="cls expand">read</a>(
-<span class="pre">Object response</span>)
- : Ext.data.ResultSet</div><div class="description"><div class="short">Reads the given response object. This method normalizes the different types of response object that may be passed
-to ...</div><div class="long"><p>Reads the given response object. This method normalizes the different types of response object that may be passed
-to it, before handing off the reading of records to the <a href="Ext.data.reader.Xml.html#readRecords" rel="Ext.data.reader.Xml#readRecords" class="docClass">readRecords</a> function.</p>
-<h3 class="pa">Parameters</h3><ul><li><span class="pre">response</span> : Object<div class="sub-desc"><p>The response object. This may be either an XMLHttpRequest object or a plain JS object</p>
-</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Ext.data.ResultSet</span> <p>The parsed ResultSet object</p>
-</li></ul></div></div></div><div id="method-readRecords" class="member ni"><a href="Ext.data.reader.Xml.html#method-readRecords" rel="method-readRecords" class="expand more ar"><span> </span></a><div class="title"><div class="meta"><a href="Ext.data.reader.Xml.html" class="definedIn docClass">Ext.data.reader.Xml</a><br/><a href="../source/Xml.html#Ext-data.reader.Xml-method-readRecords" class="viewSource">view source</a></div><a name="readRecords"></a><a name="method-readRecords"></a><a href="Ext.data.reader.Xml.html#" rel="method-readRecords" class="cls expand">readRecords</a>(
-<span class="pre">Object doc</span>)
- : Ext.data.ResultSet</div><div class="description"><div class="short"><p>Parses an XML document and returns a ResultSet containing the model instances</p>
-</div><div class="long"><p>Parses an XML document and returns a ResultSet containing the model instances</p>
-<h3 class="pa">Parameters</h3><ul><li><span class="pre">doc</span> : Object<div class="sub-desc"><p>Parsed XML document</p>
-</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Ext.data.ResultSet</span> <p>The parsed result set</p>
-</li></ul></div></div></div></div></div></div></div><div id="pageContent"></div></div></div></div></body></html>
\ No newline at end of file