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