git.ithinksw.org
/
extjs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Upgrade to ExtJS 4.0.7 - Released 10/19/2011
[extjs.git]
/
docs
/
source
/
Xml.html
diff --git
a/docs/source/Xml.html
b/docs/source/Xml.html
index
6c9f8be
..
e8d7cea
100644
(file)
--- a/
docs/source/Xml.html
+++ b/
docs/source/Xml.html
@@
-3,8
+3,8
@@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The source code</title>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The source code</title>
- <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
- <script type="text/javascript" src="../prettify/prettify.js"></script>
+ <link href="../
resources/
prettify/prettify.css" type="text/css" rel="stylesheet" />
+ <script type="text/javascript" src="../
resources/
prettify/prettify.js"></script>
<style type="text/css">
.highlight { display: block; background-color: #ddd; }
</style>
<style type="text/css">
.highlight { display: block; background-color: #ddd; }
</style>
@@
-19,17
+19,17
@@
</span> * @author Ed Spencer
* @class Ext.data.reader.Xml
* @extends Ext.data.reader.Reader
</span> * @author Ed Spencer
* @class Ext.data.reader.Xml
* @extends Ext.data.reader.Reader
- *
+ *
* <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>
* <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><code>
Ext.define('User', {
extend: 'Ext.data.Model',
fields: ['id', 'name', 'email']
});
<pre><code>
Ext.define('User', {
extend: 'Ext.data.Model',
fields: ['id', 'name', 'email']
});
-var store =
new Ext.data.Store(
{
+var store =
Ext.create('Ext.data.Store',
{
model: 'User',
proxy: {
type: 'ajax',
model: 'User',
proxy: {
type: 'ajax',
@@
-41,14
+41,14
@@
var store = new Ext.data.Store({
}
});
</code></pre>
}
});
</code></pre>
- *
+ *
* <p>The example above creates a 'User' model. Models are explained in the {@link Ext.data.Model Model} docs if you're
* not already familiar with them.</p>
* <p>The example above creates a 'User' model. Models are explained in the {@link Ext.data.Model Model} docs if you're
* not already familiar with them.</p>
- *
- * <p>We created the simplest type of XML Reader possible by simply telling our {@link Ext.data.Store Store}'s
+ *
+ * <p>We created the simplest type of XML Reader possible by simply telling our {@link Ext.data.Store Store}'s
* {@link Ext.data.proxy.Proxy Proxy} 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:
* {@link Ext.data.proxy.Proxy Proxy} 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><code>
reader: {
type : 'xml',
<pre><code>
reader: {
type : 'xml',
@@
-56,7
+56,7
@@
reader: {
record: 'user'
}
</code></pre>
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><code>
* <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><code>
@@
-72,16
+72,16
@@
reader: {
&lt;email&gt;abe@sencha.com&lt;/email&gt;
&lt;/user&gt;
</code></pre>
&lt;email&gt;abe@sencha.com&lt;/email&gt;
&lt;/user&gt;
</code></pre>
- *
+ *
* <p>The XML Reader uses the configured {@link #record} option to pull out the data for each record - in this case we
* set record to 'user', so each &lt;user&gt; above will be converted into a User model.</p>
* <p>The XML Reader uses the configured {@link #record} option to pull out the data for each record - in this case we
* set record to 'user', so each &lt;user&gt; above will be converted into a User model.</p>
- *
+ *
* <p><u>Reading other XML formats</u></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
* <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
+ * pass XmlReader a couple of configuration options to make it parse your format. For example, we can use the
* {@link #root} configuration to parse data that comes back like this:</p>
* {@link #root} configuration to parse data that comes back like this:</p>
- *
+ *
<pre><code>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;users&gt;
<pre><code>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;users&gt;
@@
-97,9
+97,9
@@
reader: {
&lt;/user&gt;
&lt;/users&gt;
</code></pre>
&lt;/user&gt;
&lt;/users&gt;
</code></pre>
- *
+ *
* <p>To parse this we just pass in a {@link #root} configuration that matches the 'users' above:</p>
* <p>To parse this we just pass in a {@link #root} configuration that matches the 'users' above:</p>
- *
+ *
<pre><code>
reader: {
type : 'xml',
<pre><code>
reader: {
type : 'xml',
@@
-107,10
+107,10
@@
reader: {
record: 'user'
}
</code></pre>
record: 'user'
}
</code></pre>
- *
+ *
* <p>Note that XmlReader doesn't care whether your {@link #root} and {@link #record} elements are nested deep inside
* a larger structure, so a response like this will still work:
* <p>Note that XmlReader doesn't care whether your {@link #root} and {@link #record} elements are nested deep inside
* a larger structure, so a response like this will still work:
- *
+ *
<pre><code>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;deeply&gt;
<pre><code>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;deeply&gt;
@@
-132,13
+132,13
@@
reader: {
&lt;/nested&gt;
&lt;/deeply&gt;
</code></pre>
&lt;/nested&gt;
&lt;/deeply&gt;
</code></pre>
- *
+ *
* <p><u>Response metadata</u></p>
* <p><u>Response metadata</u></p>
- *
- * <p>The server can return additional data in its response, such as the {@link #totalProperty total number of records}
+ *
+ * <p>The server can return additional data in its response, such as the {@link #totalProperty total number of records}
* and the {@link #successProperty success status of the response}. These are typically included in the XML response
* like this:</p>
* and the {@link #successProperty success status of the response}. These are typically included in the XML response
* like this:</p>
- *
+ *
<pre><code>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;total&gt;100&lt;/total&gt;
<pre><code>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;total&gt;100&lt;/total&gt;
@@
-156,11
+156,11
@@
reader: {
&lt;/user&gt;
&lt;/users&gt;
</code></pre>
&lt;/user&gt;
&lt;/users&gt;
</code></pre>
- *
+ *
* <p>If these properties are present in the XML response they can be parsed out by the XmlReader and used by the
* <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
+ * Store that loaded it. We can set up the names of these properties by specifying a final pair of configuration
* options:</p>
* options:</p>
- *
+ *
<pre><code>
reader: {
type: 'xml',
<pre><code>
reader: {
type: 'xml',
@@
-169,14
+169,14
@@
reader: {
successProperty: 'success'
}
</code></pre>
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>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><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
+ *
+ * <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>
*/
* response must be set to "text/xml" or "application/xml". This is very important - the XmlReader will not
* work correctly otherwise.</p>
*/
@@
-184,9
+184,10
@@
Ext.define('Ext.data.reader.Xml', {
extend: 'Ext.data.reader.Reader',
alternateClassName: 'Ext.data.XmlReader',
alias : 'reader.xml',
extend: 'Ext.data.reader.Reader',
alternateClassName: 'Ext.data.XmlReader',
alias : 'reader.xml',
-
+
<span id='Ext-data-reader-Xml-cfg-record'> /**
<span id='Ext-data-reader-Xml-cfg-record'> /**
-</span> * @cfg {String} record The DomQuery path to the repeated element which contains record information.
+</span> * @cfg {String} record (required)
+ * The DomQuery path to the repeated element which contains record information.
*/
<span id='Ext-data-reader-Xml-method-createAccessor'> /**
*/
<span id='Ext-data-reader-Xml-method-createAccessor'> /**
@@
-198,20
+199,20
@@
Ext.define('Ext.data.reader.Xml', {
*/
createAccessor: function(expr) {
var me = this;
*/
createAccessor: function(expr) {
var me = this;
-
+
if (Ext.isEmpty(expr)) {
return Ext.emptyFn;
}
if (Ext.isEmpty(expr)) {
return Ext.emptyFn;
}
-
+
if (Ext.isFunction(expr)) {
return expr;
}
if (Ext.isFunction(expr)) {
return expr;
}
-
+
return function(root) {
return me.getNodeValue(Ext.DomQuery.selectNode(expr, root));
};
},
return function(root) {
return me.getNodeValue(Ext.DomQuery.selectNode(expr, root));
};
},
-
+
getNodeValue: function(node) {
if (node && node.firstChild) {
return node.firstChild.nodeValue;
getNodeValue: function(node) {
if (node && node.firstChild) {
return node.firstChild.nodeValue;
@@
-248,12
+249,12
@@
Ext.define('Ext.data.reader.Xml', {
</span> * @private
* Given an XML object, returns the Element that represents the root as configured by the Reader's meta data
* @param {Object} data The XML data object
</span> * @private
* Given an XML object, returns the Element that represents the root as configured by the Reader's meta data
* @param {Object} data The XML data object
- * @return {Element} The root node element
+ * @return {
XML
Element} The root node element
*/
getRoot: function(data) {
var nodeName = data.nodeName,
root = this.root;
*/
getRoot: function(data) {
var nodeName = data.nodeName,
root = this.root;
-
+
if (!root || (nodeName && nodeName == root)) {
return data;
} else if (Ext.DomQuery.isXml(data)) {
if (!root || (nodeName && nodeName == root)) {
return data;
} else if (Ext.DomQuery.isXml(data)) {
@@
-267,18
+268,18
@@
Ext.define('Ext.data.reader.Xml', {
<span id='Ext-data-reader-Xml-method-extractData'> /**
</span> * @private
* We're just preparing the data for the superclass by pulling out the record nodes we want
<span id='Ext-data-reader-Xml-method-extractData'> /**
</span> * @private
* We're just preparing the data for the superclass by pulling out the record nodes we want
- * @param {Element} root The XML root node
- * @return {
Array
} The records
+ * @param {
XML
Element} root The XML root node
+ * @return {
Ext.data.Model[]
} The records
*/
extractData: function(root) {
var recordName = this.record;
*/
extractData: function(root) {
var recordName = this.record;
-
+
//<debug>
if (!recordName) {
Ext.Error.raise('Record is a required parameter');
}
//</debug>
//<debug>
if (!recordName) {
Ext.Error.raise('Record is a required parameter');
}
//</debug>
-
+
if (recordName != root.nodeName) {
root = Ext.DomQuery.select(recordName, root);
} else {
if (recordName != root.nodeName) {
root = Ext.DomQuery.select(recordName, root);
} else {
@@
-286,13
+287,13
@@
Ext.define('Ext.data.reader.Xml', {
}
return this.callParent([root]);
},
}
return this.callParent([root]);
},
-
+
<span id='Ext-data-reader-Xml-method-getAssociatedDataRoot'> /**
</span> * @private
* See Ext.data.reader.Reader's getAssociatedDataRoot docs
<span id='Ext-data-reader-Xml-method-getAssociatedDataRoot'> /**
</span> * @private
* See Ext.data.reader.Reader's getAssociatedDataRoot docs
- * @param {
Mixed
} data The raw data object
+ * @param {
Object
} data The raw data object
* @param {String} associationName The name of the association to get data for (uses associationKey if present)
* @param {String} associationName The name of the association to get data for (uses associationKey if present)
- * @return {
Mixed
} The root
+ * @return {
XMLElement
} The root
*/
getAssociatedDataRoot: function(data, associationName) {
return Ext.DomQuery.select(associationName, data)[0];
*/
getAssociatedDataRoot: function(data, associationName) {
return Ext.DomQuery.select(associationName, data)[0];
@@
-308,9
+309,9
@@
Ext.define('Ext.data.reader.Xml', {
if (Ext.isArray(doc)) {
doc = doc[0];
}
if (Ext.isArray(doc)) {
doc = doc[0];
}
-
+
<span id='Ext-data-reader-Xml-property-xmlData'> /**
<span id='Ext-data-reader-Xml-property-xmlData'> /**
-</span> *
DEPRECATED -
will be removed in Ext JS 5.0. This is just a copy of this.rawData - use that instead
+</span> *
@deprecated
will be removed in Ext JS 5.0. This is just a copy of this.rawData - use that instead
* @property xmlData
* @type Object
*/
* @property xmlData
* @type Object
*/