所问问题如题
1条回答 默认 最新
- suziwen 2010-05-17 13:32关注
用Ext.data.XmlReader
[code="js"]Class Ext.data.XmlReader
Package: Ext.data
Defined In: XmlReader.js
Class: XmlReader
Extends: DataReader
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.Note: that in order for the browser to parse a returned XML document, the Content-Type header in the HTTP response must be set to "text/xml" or "application/xml".
Example code:
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({
totalRecords: "results", // The element which contains the total dataset size (optional)
record: "row", // The repeated element which contains row information
id: "id" // The element within the row that provides an ID for the record (optional)
}, Employee);
This would consume an XML file like this:<?xml version="1.0" encoding="UTF-8"?>
2
1
Bill
Gardener
2
Ben
Horticulturalist[/code]
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 悬赏Python-playwright部署在centos7上
- ¥15 psoc creator软件有没有人能远程安装啊
- ¥15 快速扫描算法求解Eikonal方程咨询
- ¥20 我的是道格手机,重置后屏幕右上角出现红色字的未写入tee key 和未写入google key请问怎么去掉啊
- ¥30 关于R语言运行分区生存模型中的问题!
- ¥15 校内二手商品转让网站
- ¥20 高德地图聚合图层MarkerCluster聚合多个点,但是ClusterData只有其中部分数据,原因应该是有经纬度重合的地方点,现在我想让ClusterData显示所有点的信息,如何实现?
- ¥100 求Web版SPC控制图程序包调式
- ¥20 指导如何跑通以下两个Github代码
- ¥15 大家知道这个后备文件怎么删吗,为啥这些文件我只看到一份,没有后备呀