You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
3.8 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js"><span id='Ext-data-XmlStore-method-constructor'><span id='Ext-data-XmlStore'>/**
  19. </span></span> * @class Ext.data.XmlStore
  20. * @extends Ext.data.Store
  21. * &lt;p&gt;Small helper class to make creating {@link Ext.data.Store}s from XML data easier.
  22. * A XmlStore will be automatically configured with a {@link Ext.data.XmlReader}.&lt;/p&gt;
  23. * &lt;p&gt;A store configuration would be something like:&lt;pre&gt;&lt;code&gt;
  24. var store = new Ext.data.XmlStore({
  25. // store configs
  26. autoDestroy: true,
  27. storeId: 'myStore',
  28. url: 'sheldon.xml', // automatically configures a HttpProxy
  29. // reader configs
  30. record: 'Item', // records will have an &quot;Item&quot; tag
  31. idPath: 'ASIN',
  32. totalRecords: '@TotalResults'
  33. fields: [
  34. // set up the fields mapping into the xml doc
  35. // The first needs mapping, the others are very basic
  36. {name: 'Author', mapping: 'ItemAttributes &gt; Author'},
  37. 'Title', 'Manufacturer', 'ProductGroup'
  38. ]
  39. });
  40. * &lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;
  41. * &lt;p&gt;This store is configured to consume a returned object of the form:&lt;pre&gt;&lt;code&gt;
  42. &amp;#60?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  43. &amp;#60ItemSearchResponse xmlns=&quot;http://webservices.amazon.com/AWSECommerceService/2009-05-15&quot;&gt;
  44. &amp;#60Items&gt;
  45. &amp;#60Request&gt;
  46. &amp;#60IsValid&gt;True&amp;#60/IsValid&gt;
  47. &amp;#60ItemSearchRequest&gt;
  48. &amp;#60Author&gt;Sidney Sheldon&amp;#60/Author&gt;
  49. &amp;#60SearchIndex&gt;Books&amp;#60/SearchIndex&gt;
  50. &amp;#60/ItemSearchRequest&gt;
  51. &amp;#60/Request&gt;
  52. &amp;#60TotalResults&gt;203&amp;#60/TotalResults&gt;
  53. &amp;#60TotalPages&gt;21&amp;#60/TotalPages&gt;
  54. &amp;#60Item&gt;
  55. &amp;#60ASIN&gt;0446355453&amp;#60/ASIN&gt;
  56. &amp;#60DetailPageURL&gt;
  57. http://www.amazon.com/
  58. &amp;#60/DetailPageURL&gt;
  59. &amp;#60ItemAttributes&gt;
  60. &amp;#60Author&gt;Sidney Sheldon&amp;#60/Author&gt;
  61. &amp;#60Manufacturer&gt;Warner Books&amp;#60/Manufacturer&gt;
  62. &amp;#60ProductGroup&gt;Book&amp;#60/ProductGroup&gt;
  63. &amp;#60Title&gt;Master of the Game&amp;#60/Title&gt;
  64. &amp;#60/ItemAttributes&gt;
  65. &amp;#60/Item&gt;
  66. &amp;#60/Items&gt;
  67. &amp;#60/ItemSearchResponse&gt;
  68. * &lt;/code&gt;&lt;/pre&gt;
  69. * An object literal of this form could also be used as the {@link #data} config option.&lt;/p&gt;
  70. * &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; Although not listed here, this class accepts all of the configuration options of
  71. * &lt;b&gt;{@link Ext.data.XmlReader XmlReader}&lt;/b&gt;.&lt;/p&gt;
  72. * @constructor
  73. * @param {Object} config
  74. * @xtype xmlstore
  75. */
  76. Ext.data.XmlStore = Ext.extend(Ext.data.Store, {
  77. <span id='Ext-data-XmlStore-cfg-reader'> /**
  78. </span> * @cfg {Ext.data.DataReader} reader @hide
  79. */
  80. constructor: function(config){
  81. Ext.data.XmlStore.superclass.constructor.call(this, Ext.apply(config, {
  82. reader: new Ext.data.XmlReader(config)
  83. }));
  84. }
  85. });
  86. Ext.reg('xmlstore', Ext.data.XmlStore);</pre>
  87. </body>
  88. </html>