打印版式

Class Ext.data.XmlReader

Package:Ext.data
Class:XmlReader
Extends:Ext.data.DataReader
Defined In:XmlReader.js
Data reader class to create an Array of Ext.data.Record objects from an XML document based on mappings in a provided Ext.data.Record constructor.

The code below lists all configuration options.

var myReader = new Ext.data.XmlReader({
   record: "row",           // The repeated element which contains record information
   totalRecords: "results", // The element which contains the number of returned records (可选)
   id: "id"                 // The element within the record that provides an ID for the record (可选)
}, myRecordDefinition);

This would consume an XML file like this:


<?xml?>
<dataset>
 <results>2</results>
 <row>
   <id>1</id>
   <name>Bill</name>
 </row>
 <row>
   <id>2</id>
   <name>Ben</name>
 </row>
</dataset>

属性   -  方法   -  事件   -  设置选项

公共属性

属性 定义对象
  xmlData : XMLDocument XmlReader
After any data loads/reads, the raw XML Document is available for further custom processing.

公共方法

方法 定义对象
  XmlReader(Object meta, Mixed recordType) XmlReader
Create a new XmlReader
  read(Object response) : Object XmlReader
This method is only used by a DataProxy which has retrieved data from a remote server.
  readRecords(Object doc) : Object XmlReader
Create a data block containing Ext.data.Records from an XML document.

公共事件

此类没有公共事件。

设置选项

设置选项 定义对象
  id : String XmlReader
The DomQuery path relative from the record element to the element that contains a record identifier value.
  record : String XmlReader
The DomQuery path to the repeated element which contains record information.
  success : String XmlReader
The DomQuery path to the success attribute used by forms.
  totalRecords : String XmlReader
The DomQuery path from which to retrieve the total number of records in the dataset. This is only needed if the whole...

属性详情

xmlData

public XMLDocument xmlData
After any data loads/reads, the raw XML Document is available for further custom processing.
This property is defined by XmlReader.

构造函数

XmlReader

public function XmlReader(Object meta, Mixed recordType)
Create a new XmlReader
参数:
  • meta : Object
    Metadata configuration options
  • recordType : Mixed
    The definition of the data record type to produce. This can be either a valid Record subclass created with Ext.data.Record.create, or an array of objects with which to call Ext.data.Record.create. See the Ext.data.Record class for more details.

方法详情

read

public function read(Object response)
This method is only used by a DataProxy which has retrieved data from a remote server.
参数:
  • response : Object
    The XHR object which contains the parsed XML document. The response is expected to contain a method called 'responseXML' that returns an XML document object.
返回:
  • Object
    records A data block which is used by an {@link Ext.data.Store} as a cache of Ext.data.Records.
This method is defined by XmlReader.

readRecords

public function readRecords(Object doc)
Create a data block containing Ext.data.Records from an XML document.
参数:
  • doc : Object
    A parsed XML document.
返回:
  • Object
    records A data block which is used by an {@link Ext.data.Store} as a cache of Ext.data.Records.
This method is defined by XmlReader.

设置详情

id

id : String
The DomQuery path relative from the record element to the element that contains a record identifier value.
This config option is defined by XmlReader.

record

record : String
The DomQuery path to the repeated element which contains record information.
This config option is defined by XmlReader.

success

success : String
The DomQuery path to the success attribute used by forms.
This config option is defined by XmlReader.

totalRecords

totalRecords : String
The DomQuery path 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.
This config option is defined by XmlReader.

Ext - Copyright © 2006-2007 Ext JS, LLC
All rights reserved.