tags:

views:

329

answers:

1

I have a xml that i need to bind to XTemplate. The XML structure is as follows

<Name>
 <Student_Name>
     <First>John</First>
     <Last>Smith</Last>
 </Student_Name>
 <Student_Name>
     <First>John</First>
     <Last>Doe</Last>
 </Student_Name>
 <Faculty_Name>
     <First>Johny</First>
     <Last>Byrd</Last>
 </Student_Name>
</Name>

I am using Ext.data.Store with proxyurl tot he xml, Ext.data.XML reader to rad the xml and a listener that bind the data to the Xtemplate. The xmlreader needs a root node to be specified and i have to give root name as "Student_Name" It need to bind it to one more store for "Faculty_Name" as the root node. SO i end up calling my service to get xml twice. Is there a way to call service once to get the xml and bind it to two stores with different root nodes.

A: 

At the risk of sounding like Captain Obvious, you actually need 2 root nodes in your data. I would also suggest renaming your nodes (if possible) to eliminate redundancy and make your XML more semantically logical, e.g.,

<People>
 <Students>
  <Name>
     <First>John</First>
     <Last>Smith</Last>
  </Name>
  <Name>
     <First>John</First>
     <Last>Doe</Last>
  </Name>
 </Students>
 <Faculty>
  <Name>
     <First>Johny</First>
     <Last>Byrd</Last>
  </Name>
 </Faculty>
</People>

That way Students and Faculty can be your 2 separate root nodes and you'll only need a single server call.

bmoeskau