<HddzReportDataSeries xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
  <Titlecolspan>0</Titlecolspan> 
  <MinValue>0</MinValue> 
  <MaxValue>0</MaxValue> 
  <SubTitle>压力</SubTitle> 
   <SensorId>795</SensorId> 
  <Title>广电中心</Title> 
  <Unit>MPa</Unit> 
 <DataPoints>
 <HddzReportDataPoint>
  <SensorID>0</SensorID> 
  <Strvalue>0.326</Strvalue> 
  <IsComplete>false</IsComplete> 
  <DateTime>2010-07-05T13:45:00</DateTime> 
  <Value>0.32600000500679</Value> 
  <AlarmType>0</AlarmType> 
  </HddzReportDataPoint>
 <HddzReportDataPoint>
  <SensorID>0</SensorID> 
  <Strvalue>0.324</Strvalue> 
  <IsComplete>false</IsComplete> 
  <DateTime>2010-07-05T14:00:00</DateTime> 
  <Value>0.324000000953674</Value> 
  <AlarmType>0</AlarmType> 
  </HddzReportDataPoint>
  </DataPoints>
  <StatisticsSeries /> 
  </HddzReportDataSeries>
xml返回的是 HddzReportDataSeries  这个是一个数组。里面又包含了一datapoints的数组,请问,extjs中 xmlreader该如何定义啊?谢谢

解决方案 »

  1.   

    参考:
    var Employee = Ext.data.Record.create([
       {name: 'name', mapping: 'name'},     // "mapping" property not needed if it is the same as "name"
       {name: 'occupation'}                 // This field will use "occupation" as the mapping.
    ]);
    var myReader = new Ext.data.XmlReader({
       totalProperty: "results", // The element which contains the total dataset size (optional)
       record: "row",           // The repeated element which contains row information
       idProperty: "id"         // The element within the row that provides an ID for the record (optional)
       messageProperty: "msg"   // The element within the response that provides a user-feedback message (optional)
    }, Employee);
    <?xml version="1.0" encoding="UTF-8"?>
    <dataset>
     <results>2</results>
     <row>
       <id>1</id>
       <name>Bill</name>
       <occupation>Gardener</occupation>
     </row>
     <row>
       <id>2</id>
       <name>Ben</name>
       <occupation>Horticulturalist</occupation>
     </row>
    </dataset>