使用reader.readRecords(xmlDocument)将一个XML拆分N个Store

<outputdatas xmlns="XML">
<resultcode>0</resultcode>
<reason>OK</reason>
<results sets="1">
	<result rows="1" cols="9" set_id="201">
		<row rownum="1">
			<col colnum="1" param_id="2015001" param_name="">a</col>
			<col colnum="2" param_id="2015002" param_name="">070009</col>
			<col colnum="3" param_id="2015003" param_name="">程洁梅</col>
			<col colnum="4" param_id="2015004" param_name="">d</col>
			<col colnum="5" param_id="2015005" param_name="">VIP</col>
			<col colnum="6" param_id="2015006" param_name="">Killer</col>
			<col colnum="7" param_id="2015007" param_name="">value_7</col>
			<col colnum="8" param_id="2015008" param_name="">中文</col>
			<col colnum="9" param_id="2015009" param_name="">3</col>
			<col colnum="10" param_id="2015010" param_name="">value_7</col>
			<col colnum="11" param_id="2015011" param_name="">value_7</col>
			<col colnum="12" param_id="2015012" param_name="">value_7</col>
			<col colnum="13" param_id="2015013" param_name="">100%</col>
			<col colnum="14" param_id="2015014" param_name="">80%</col>
			<col colnum="15" param_id="2015015" param_name="">无</col>
			<col colnum="16" param_id="2015016" param_name="">value_7</col>
			<col colnum="17" param_id="2015017" param_name="">ggg</col>
			<col colnum="18" param_id="2015018" param_name="">value_7</col>
			<col colnum="19" param_id="2015019" param_name="">value_7</col>
			<col colnum="20" param_id="2015020" param_name="">value_7</col>
		</row>
	</result> 
	<result rows="2" cols="9" set_id="202">
		<row rownum="1">
			<col colnum="1" param_id="2015031" param_name="">value_1</col>
			<col colnum="2" param_id="2015032" param_name="">13513513541654631X</col>
			<col colnum="3" param_id="2015033" param_name="">45413513</col>
			<col colnum="4" param_id="2015034" param_name="">不知道</col>
		</row>
	</result> 
	<result rows="2" cols="9" set_id="203">
		<row rownum="1">
			<col colnum="1" param_id="2015041" param_name="">程洁梅</col>
		</row>
	</result> 
	<result rows="2" cols="9" set_id="204">
		<row rownum="1">
			<col colnum="1" param_id="2015051" param_name=""></col>
			<col colnum="1" param_id="2015052" param_name="">广州市大沙头二马路55号之一4铺都城快餐店</col>
			<col colnum="1" param_id="2015053" param_name="">138XXXXXXXX</col>
			<col colnum="1" param_id="2015054" param_name="">[email protected]</col>
			<col colnum="1" param_id="2015055" param_name="">999</col>
		</row>
	</result> 
	<result rows="2" cols="9" set_id="205">
		<row rownum="1">
			<col colnum="1" param_id="2015061" param_name="">黑名单</col>
		</row>
	</result> 
	<result rows="2" cols="9" set_id="206">
		<row rownum="1">
			<col colnum="1" param_id="2015071" param_name="">金领</col>
		</row>
	</result> 
	<result rows="2" cols="9" set_id="208">
		<row rownum="1">
			<col colnum="1" param_id="2015171" param_name="">value_1</col>
			<col colnum="2" param_id="2015172" param_name="">value_2011</col>
			<col colnum="3" param_id="2015173" param_name="">value_3</col>
			<col colnum="4" param_id="2015174" param_name="">value_4</col>
			<col colnum="5" param_id="2015175" param_name="">value_5</col>
			<col colnum="6" param_id="2015176" param_name="">value_6</col>
			<col colnum="7" param_id="2015177" param_name="">value_7</col>
			<col colnum="8" param_id="2015178" param_name="">value_8</col>
			<col colnum="9" param_id="2015179" param_name="">value_9</col>
			<col colnum="10" param_id="2015180" param_name="">value_0</col>
			<col colnum="11" param_id="2015181" param_name="">value_1</col>
			<col colnum="12" param_id="2015182" param_name="">value_2</col>
			<col colnum="13" param_id="2015183" param_name="">value_3</col>
			<col colnum="14" param_id="2015184" param_name="">value_4</col>
		</row>
		<row rownum="2">
			<col colnum="1" param_id="2015171" param_name="">value_1</col>
			<col colnum="2" param_id="2015172" param_name="">value_2012</col>
			<col colnum="3" param_id="2015173" param_name="">value_3</col>
			<col colnum="4" param_id="2015174" param_name="">value_4</col>
			<col colnum="5" param_id="2015175" param_name="">value_5</col>
			<col colnum="6" param_id="2015176" param_name="">value_6</col>
			<col colnum="7" param_id="2015177" param_name="">value_7</col>
			<col colnum="8" param_id="2015178" param_name="">value_8</col>
			<col colnum="9" param_id="2015179" param_name="">value_9</col>
			<col colnum="10" param_id="2015180" param_name="">value_0</col>
			<col colnum="11" param_id="2015181" param_name="">value_1</col>
			<col colnum="12" param_id="2015182" param_name="">value_2</col>
			<col colnum="13" param_id="2015183" param_name="">value_3</col>
			<col colnum="14" param_id="2015184" param_name="">value_4</col>
		</row>
	</result>
	<result rows="2" cols="9" set_id="209">
		<row rownum="1">
			<col colnum="1" param_id="2015201" param_name="">value_1</col>
			<col colnum="2" param_id="2015202" param_name="">value_2091</col>
			<col colnum="3" param_id="2015203" param_name="">value_3</col>
			<col colnum="4" param_id="2015204" param_name="">value_4</col>
			<col colnum="5" param_id="2015205" param_name="">value_5</col>
			<col colnum="6" param_id="2015206" param_name="">value_6</col>
			<col colnum="7" param_id="2015207" param_name="">value_7</col>
		</row>
		<row rownum="2">
			<col colnum="1" param_id="2015201" param_name="">value_1</col>
			<col colnum="2" param_id="2015202" param_name="">value_2092</col>
			<col colnum="3" param_id="2015203" param_name="">value_3</col>
			<col colnum="4" param_id="2015204" param_name="">value_4</col>
			<col colnum="5" param_id="2015205" param_name="">value_5</col>
			<col colnum="6" param_id="2015206" param_name="">value_6</col>
			<col colnum="7" param_id="2015207" param_name="">中文</col>
		</row>
	</result> 
</results>
</outputdatas>;

GetClientInfo = function() {
	var record = {
		//客户基本信息 201~206
		cliBInfRecord : new Ext.data.Record.create([
			{name: '2015001', mapping: 'result[@set_id=201] > row > col[@param_id=2015001]'},
			{name: '2015002', mapping: 'result[@set_id=201] > row > col[@param_id=2015002]'},
			{name: '2015003', mapping: 'result[@set_id=201] > row > col[@param_id=2015003]'},
			{name: '2015004', mapping: 'result[@set_id=201] > row > col[@param_id=2015004]'},
			{name: '2015005', mapping: 'result[@set_id=201] > row > col[@param_id=2015005]'},
			{name: '2015006', mapping: 'result[@set_id=201] > row > col[@param_id=2015006]'},
			{name: '2015007', mapping: 'result[@set_id=201] > row > col[@param_id=2015007]'},
			{name: '2015008', mapping: 'result[@set_id=201] > row > col[@param_id=2015008]'},
			{name: '2015009', mapping: 'result[@set_id=201] > row > col[@param_id=2015009]'},
			{name: '2015010', mapping: 'result[@set_id=201] > row > col[@param_id=2015010]'},
			{name: '2015011', mapping: 'result[@set_id=201] > row > col[@param_id=2015011]'},
			{name: '2015012', mapping: 'result[@set_id=201] > row > col[@param_id=2015012]'},
			{name: '2015013', mapping: 'result[@set_id=201] > row > col[@param_id=2015013]'},
			{name: '2015014', mapping: 'result[@set_id=201] > row > col[@param_id=2015014]'},
			{name: '2015015', mapping: 'result[@set_id=201] > row > col[@param_id=2015015]'},
			{name: '2015016', mapping: 'result[@set_id=201] > row > col[@param_id=2015016]'},
			{name: '2015017', mapping: 'result[@set_id=201] > row > col[@param_id=2015017]'},
			{name: '2015018', mapping: 'result[@set_id=201] > row > col[@param_id=2015018]'},
			{name: '2015019', mapping: 'result[@set_id=201] > row > col[@param_id=2015019]'},
			{name: '2015020', mapping: 'result[@set_id=201] > row > col[@param_id=2015020]'},
			//客户证件信息
			{name: '2015031', mapping: 'result[@set_id=202] > row > col[@param_id=2015031]'},
			{name: '2015032', mapping: 'result[@set_id=202] > row > col[@param_id=2015032]'},
			{name: '2015033', mapping: 'result[@set_id=202] > row > col[@param_id=2015033]'},
			{name: '2015034', mapping: 'result[@set_id=202] > row > col[@param_id=2015034]'},
			//客户联系人信息
			{name: '2015041', mapping: 'result[@set_id=203] > row > col[@param_id=2015041]'},
			//地址信息
			{name: '2015051', mapping: 'result[@set_id=204] > row > col[@param_id=2015051]'},
			{name: '2015052', mapping: 'result[@set_id=204] > row > col[@param_id=2015052]'},
			{name: '2015053', mapping: 'result[@set_id=204] > row > col[@param_id=2015053]'},
			{name: '2015054', mapping: 'result[@set_id=204] > row > col[@param_id=2015054]'},
			{name: '2015055', mapping: 'result[@set_id=204] > row > col[@param_id=2015055]'},
			//黑红名单
			{name: '2015061', mapping: 'result[@set_id=205] > row > col[@param_id=2015061]'},
			//客户群客户关系
			{name: '2015071', mapping: 'result[@set_id=206] > row > col[@param_id=2015071]'}
		]),
		
		//服务基本信息207
		cliSerBInfRecord : new Ext.data.Record.create([
			{name: '2015141', mapping: 'col[@param_id=2015141]'},
			{name: '2015142', mapping: 'col[@param_id=2015142]'},
			{name: '2015143', mapping: 'col[@param_id=2015143]'},
			{name: '2015144', mapping: 'col[@param_id=2015144]'},
			{name: '2015145', mapping: 'col[@param_id=2015145]'},
			{name: '2015146', mapping: 'col[@param_id=2015146]'},
			{name: '2015147', mapping: 'col[@param_id=2015147]'},
			{name: '2015148', mapping: 'col[@param_id=2015148]'},
			{name: '2015149', mapping: 'col[@param_id=2015149]'},
			{name: '2015150', mapping: 'col[@param_id=2015150]'},
			{name: '2015151', mapping: 'col[@param_id=2015151]'},
			{name: '2015152', mapping: 'col[@param_id=2015152]'},
			{name: '2015153', mapping: 'col[@param_id=2015153]'},
			{name: '2015154', mapping: 'col[@param_id=2015154]'},
			{name: '2015155', mapping: 'col[@param_id=2015155]'},
			{name: '2015156', mapping: 'col[@param_id=2015156]'},
			{name: '2015157', mapping: 'col[@param_id=2015157]'},
			{name: '2015158', mapping: 'col[@param_id=2015158]'},
			{name: '2015159', mapping: 'col[@param_id=2015159]'}
		]),
		
		// 服务特性信息208
		cliSerFeatInfRecord : new Ext.data.Record.create([
			{name: '2015171', mapping: 'col[@param_id=2015171]'},
			{name: '2015172', mapping: 'col[@param_id=2015172]'},
			{name: '2015173', mapping: 'col[@param_id=2015173]'},
			{name: '2015174', mapping: 'col[@param_id=2015174]'},
			{name: '2015175', mapping: 'col[@param_id=2015175]'},
			{name: '2015176', mapping: 'col[@param_id=2015176]'},
			{name: '2015177', mapping: 'col[@param_id=2015177]'},
			 {name: '2015178', mapping: 'col[@param_id=2015178]'},
			{name: '2015179', mapping: 'col[@param_id=2015179]'},
			{name: '2015180', mapping: 'col[@param_id=2015180]'},
			{name: '2015181', mapping: 'col[@param_id=2015181]'},
			{name: '2015182', mapping: 'col[@param_id=2015182]'},
			{name: '2015183', mapping: 'col[@param_id=2015183]'},
			{name: '2015184', mapping: 'col[@param_id=2015184]'}
		]),
		
		//服务关系信息209
		cliSerRelInfRecord : new Ext.data.Record.create([
			{name: '2015201', mapping: 'col[@param_id=2015201]'},
			{name: '2015202', mapping: 'col[@param_id=2015202]'},
			{name: '2015203', mapping: 'col[@param_id=2015203]'},
			{name: '2015204', mapping: 'col[@param_id=2015204]'},
			{name: '2015205', mapping: 'col[@param_id=2015205]'},
			{name: '2015206', mapping: 'col[@param_id=2015206]'},
			{name: '2015207', mapping: 'col[@param_id=2015207]'}
		]),
		
		//黑红名单信息210 
		cliBRListInfRecord : new Ext.data.Record.create([
			{name: '2015211', mapping: 'col[@param_id=2015211]'},
			{name: '2015212', mapping: 'col[@param_id=2015212]'},
			{name: '2015213', mapping: 'col[@param_id=2015213]'},
			{name: '2015214', mapping: 'col[@param_id=2015214]'},
			{name: '2015215', mapping: 'col[@param_id=2015215]'},
			{name: '2015216', mapping: 'col[@param_id=2015216]'},
			{name: '2015217', mapping: 'col[@param_id=2015217]'},
			{name: '2015218', mapping: 'col[@param_id=2015218]'},
			{name: '2015219', mapping: 'col[@param_id=2015219]'},
			{name: '2015220', mapping: 'col[@param_id=2015220]'},
			{name: '2015231', mapping: 'col[@param_id=2015231]'},
			{name: '2015232', mapping: 'col[@param_id=2015232]'},
			{name: '2015233', mapping: 'col[@param_id=2015233]'},
			{name: '2015234', mapping: 'col[@param_id=2015234]'},
			{name: '2015235', mapping: 'col[@param_id=2015235]'},
			{name: '2015236', mapping: 'col[@param_id=2015236]'},
			{name: '2015237', mapping: 'col[@param_id=2015237]'},
			{name: '2015238', mapping: 'col[@param_id=2015238]'},
			{name: '2015239', mapping: 'col[@param_id=2015239]'},
			{name: '2015240', mapping: 'col[@param_id=2015240]'},
			{name: '2015241', mapping: 'col[@param_id=2015241]'},
			{name: '2015242', mapping: 'col[@param_id=2015242]'},
			{name: '2015243', mapping: 'col[@param_id=2015243]'}
		]),
		
		//帐户基本信息211
		cliAccBInfRecord : new Ext.data.Record.create([
			{name: '2015251', mapping: 'col[@param_id=2015251]'},
			{name: '2015252', mapping: 'col[@param_id=2015252]'},
			{name: '2015253', mapping: 'col[@param_id=2015253]'},
			{name: '2015254', mapping: 'col[@param_id=2015254]'},
			{name: '2015255', mapping: 'col[@param_id=2015255]'},
			{name: '2015256', mapping: 'col[@param_id=2015256]'},
			{name: '2015257', mapping: 'col[@param_id=2015257]'},
			{name: '2015258', mapping: 'col[@param_id=2015258]'},
			{name: '2015259', mapping: 'col[@param_id=2015259]'},
			{name: '2015260', mapping: 'col[@param_id=2015260]'},
			{name: '2015261', mapping: 'col[@param_id=2015261]'},
			{name: '2015262', mapping: 'col[@param_id=2015262]'}
		]),
		
		//支付方案信息 212
		cliPayPlanInfRecord : new Ext.data.Record.create([
			{name: '2015271', mapping: 'col[@param_id=2015271]'},
			{name: '2015272', mapping: 'col[@param_id=2015272]'},
			{name: '2015273', mapping: 'col[@param_id=2015273]'},
			{name: '2015274', mapping: 'col[@param_id=2015274]'},
			{name: '2015275', mapping: 'col[@param_id=2015275]'},
			{name: '2015276', mapping: 'col[@param_id=2015276]'},
			{name: '2015277', mapping: 'col[@param_id=2015277]'},
			{name: '2015278', mapping: 'col[@param_id=2015278]'},
			{name: '2015279', mapping: 'col[@param_id=2015279]'}
		]),
		
		//服务帐户关系信息213
		cliSerAccRelInfRecord : new Ext.data.Record.create([
			{name: '2015301', mapping: 'col[@param_id=2015301]'},
			{name: '2015302', mapping: 'col[@param_id=2015302]'},
			{name: '2015303', mapping: 'col[@param_id=2015303]'},
			{name: '2015304', mapping: 'col[@param_id=2015304]'},
			{name: '2015305', mapping: 'col[@param_id=2015305]'},
			{name: '2015306', mapping: 'col[@param_id=2015306]'},
			{name: '2015307', mapping: 'col[@param_id=2015307]'},
			{name: '2015308', mapping: 'col[@param_id=2015308]'},
			{name: '2015309', mapping: 'col[@param_id=2015309]'},
			{name: '2015310', mapping: 'col[@param_id=2015310]'},
			{name: '2015311', mapping: 'col[@param_id=2015311]'},
			{name: '2015312', mapping: 'col[@param_id=2015312]'},
			{name: '2015313', mapping: 'col[@param_id=2015313]'},
			{name: '2015314', mapping: 'col[@param_id=2015314]'},
			{name: '2015315', mapping: 'col[@param_id=2015315]'},
			{name: '2015316', mapping: 'col[@param_id=2015316]'},
			{name: '2015317', mapping: 'col[@param_id=2015317]'},
			{name: '2015318', mapping: 'col[@param_id=2015318]'},
			{name: '2015319', mapping: 'col[@param_id=2015319]'},
			{name: '2015320', mapping: 'col[@param_id=2015320]'},
			{name: '2015321', mapping: 'col[@param_id=2015321]'}
		]),
		
		//客户扩展属性信息214
		cliExpAttrInfRecord : new Ext.data.Record.create([
			{name: '2015331', mapping: 'col[@param_id=2015331]'},
			{name: '2015332', mapping: 'col[@param_id=2015332]'},
			{name: '2015333', mapping: 'col[@param_id=2015333]'},
			{name: '2015334', mapping: 'col[@param_id=2015334]'},
			{name: '2015335', mapping: 'col[@param_id=2015335]'},
			{name: '2015336', mapping: 'col[@param_id=2015336]'},
			{name: '2015337', mapping: 'col[@param_id=2015337]'},
			{name: '2015338', mapping: 'col[@param_id=2015338]'},
			{name: '2015339', mapping: 'col[@param_id=2015339]'},
			{name: '2015340', mapping: 'col[@param_id=2015340]'},
			{name: '2015341', mapping: 'col[@param_id=2015341]'},
			{name: '2015342', mapping: 'col[@param_id=2015342]'},
			{name: '2015343', mapping: 'col[@param_id=2015343]'},
			{name: '2015344', mapping: 'col[@param_id=2015344]'}
		]),
		
		//客户品牌信息215
		cliBrandInfRecord : new Ext.data.Record.create([
			{name: '2015351', mapping: 'col[@param_id=2015351]'},
			{name: '2015352', mapping: 'col[@param_id=2015352]'},
			{name: '2015353', mapping: 'col[@param_id=2015353]'},
			{name: '2015354', mapping: 'col[@param_id=2015354]'},
			{name: '2015355', mapping: 'col[@param_id=2015355]'}
		]),
		
		//客户管控属性216
		cliMgtCtrAttrRecord : new Ext.data.Record.create([
			{name: '2015361', mapping: 'col[@param_id=2015361]'},
			{name: '2015362', mapping: 'col[@param_id=2015362]'},
			{name: '2015363', mapping: 'col[@param_id=2015363]'}
		])
	};
	
	var clientDs = {
		cliBInfDs: '',
		cliSerBInfDs: '',
		cliSerFeatInfDs: '',
		cliSerRelInfDs: '',
		cliBRListInfDs: '',
		cliAccBInfDs: '',
		cliPayPlanInfDs: '',
		cliSerAccRelInfDs: '',
		cliExpAttrInfDs: '',
		cliBrandInfDs: '',
		cliMgtCtrAttrDs: ''
	};
	//同步请求
	var result = Synchronize('clientInfo.do?action=getClientInfo');
	if (result.success) {
		var xmlDocument;
		var reader,data;
		if (Ext.isIE) {
			xmlDocument = new ActiveXObject("Msxml2.FreeThreadedDOMDocument")
			xmlDocument.async = false;
			xmlDocument.resolveExternals = false;
			xmlDocument.loadXML(result.result)
		} else {
			xmlDocument = (new DOMParser()).parseFromString(result.result, "text/xml");
		}
		//客户基本信息
		reader = new Ext.data.XmlReader({
					record : "results"
				}, record.cliBInfRecord);
		data = reader.readRecords(xmlDocument);
		clientDs.cliBInfDs = data.records[0];
		//服务基本信息
		reader = new Ext.data.XmlReader({
					record : "result[set_id=207] > row"
				}, record.cliSerBInfRecord);
		data = reader.readRecords(xmlDocument);
		clientDs.cliSerBInfDs = new Ext.data.Store();
		clientDs.cliSerBInfDs.add(data.records);
		//服务特性信息
		reader = new Ext.data.XmlReader({
					record : "result[set_id=208] > row"
				}, record.cliSerFeatInfRecord);
		data = reader.readRecords(xmlDocument);
		clientDs.cliSerFeatInfDs = new Ext.data.Store();
		clientDs.cliSerFeatInfDs.add(data.records);
		//服务关系信息
		reader = new Ext.data.XmlReader({
					record : "result[set_id=209] > row"
				}, record.cliSerRelInfRecord);
		data = reader.readRecords(xmlDocument);
		clientDs.cliSerRelInfDs = new Ext.data.Store();
		clientDs.cliSerRelInfDs.add(data.records);
		//黑红名单信息
		reader = new Ext.data.XmlReader({
					record : "result[set_id=210] > row"
				}, record.cliBRListInfRecord);
		data = reader.readRecords(xmlDocument);
		clientDs.cliBRListInfDs = new Ext.data.Store();
		clientDs.cliBRListInfDs.add(data.records);
		//帐户基本信息
		reader = new Ext.data.XmlReader({
					record : "result[set_id=211] > row"
				}, record.cliAccBInfRecord);
		data = reader.readRecords(xmlDocument);
		clientDs.cliAccBInfDs = new Ext.data.Store();
		clientDs.cliAccBInfDs.add(data.records);
		//支付方案信息
		reader = new Ext.data.XmlReader({
					record : "result[set_id=212] > row"
				}, record.cliPayPlanInfRecord);
		data = reader.readRecords(xmlDocument);
		clientDs.cliPayPlanInfDs = new Ext.data.Store();
		clientDs.cliPayPlanInfDs.add(data.records);
		// 服务帐户关系信息
		reader = new Ext.data.XmlReader({
					record : "result[set_id=213] > row"
				}, record.cliSerAccRelInfRecord);
		data = reader.readRecords(xmlDocument);
		clientDs.cliSerAccRelInfDs = new Ext.data.Store();
		clientDs.cliSerAccRelInfDs.add(data.records);
		// 客户扩展属性信息
		reader = new Ext.data.XmlReader({
					record : "result[set_id=214] > row"
				}, record.cliExpAttrInfRecord);
		data = reader.readRecords(xmlDocument);
		clientDs.cliExpAttrInfDs = new Ext.data.Store();
		clientDs.cliExpAttrInfDs.add(data.records);
		// 客户品牌信息
		reader = new Ext.data.XmlReader({
					record : "result[set_id=215] > row"
				}, record.cliBrandInfRecord);
		data = reader.readRecords(xmlDocument);
		clientDs.cliBrandInfDs = new Ext.data.Store();
		clientDs.cliBrandInfDs.add(data.records);
		// 客户管控属性
		reader = new Ext.data.XmlReader({
					record : "result[set_id=216] > row"
				}, record.cliMgtCtrAttrRecord);
		data = reader.readRecords(xmlDocument);
		clientDs.cliMgtCtrAttrDs = new Ext.data.Store();
		clientDs.cliMgtCtrAttrDs.add(data.records);
	}
	return clientDs;
};

你可能感兴趣的:(xml,qq,ext)