3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js"><div id="cls-Ext.data.XmlStore"></div>/**
\r
9 * @class Ext.data.XmlStore
\r
10 * @extends Ext.data.Store
\r
11 * <p>Small helper class to make creating {@link Ext.data.Store}s from XML data easier.
\r
12 * A XmlStore will be automatically configured with a {@link Ext.data.XmlReader}.</p>
\r
13 * <p>A store configuration would be something like:<pre><code>
\r
14 var store = new Ext.data.XmlStore({
\r
18 url: 'sheldon.xml', // automatically configures a HttpProxy
\r
20 record: 'Item', // records will have an "Item" tag
\r
22 totalRecords: '@TotalResults'
\r
24 // set up the fields mapping into the xml doc
\r
25 // The first needs mapping, the others are very basic
\r
26 {name: 'Author', mapping: 'ItemAttributes > Author'},
\r
27 'Title', 'Manufacturer', 'ProductGroup'
\r
31 * <p>This store is configured to consume a returned object of the form:<pre><code>
\r
32 <?xml version="1.0" encoding="UTF-8"?>
\r
33 <ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2009-05-15">
\r
36 <IsValid>True</IsValid>
\r
37 <ItemSearchRequest>
\r
38 <Author>Sidney Sheldon</Author>
\r
39 <SearchIndex>Books</SearchIndex>
\r
40 </ItemSearchRequest>
\r
42 <TotalResults>203</TotalResults>
\r
43 <TotalPages>21</TotalPages>
\r
45 <ASIN>0446355453</ASIN>
\r
47 http://www.amazon.com/
\r
50 <Author>Sidney Sheldon</Author>
\r
51 <Manufacturer>Warner Books</Manufacturer>
\r
52 <ProductGroup>Book</ProductGroup>
\r
53 <Title>Master of the Game</Title>
\r
54 </ItemAttributes>
\r
57 </ItemSearchResponse>
\r
59 * An object literal of this form could also be used as the {@link #data} config option.</p>
\r
60 * <p><b>Note:</b> Although not listed here, this class accepts all of the configuration options of
\r
61 * <b>{@link Ext.data.XmlReader XmlReader}</b>.</p>
\r
63 * @param {Object} config
\r
66 Ext.data.XmlStore = Ext.extend(Ext.data.Store, {
\r
67 <div id="cfg-Ext.data.XmlStore-reader"></div>/**
\r
68 * @cfg {Ext.data.DataReader} reader @hide
\r
70 constructor: function(config){
\r
71 Ext.data.XmlStore.superclass.constructor.call(this, Ext.apply(config, {
\r
72 reader: new Ext.data.XmlReader(config)
\r
76 Ext.reg('xmlstore', Ext.data.XmlStore);</pre>
\r