View Full Version : insert XML string into store

24 Sep 2010, 12:03 AM
How do you insert data, from an xml string into a store.

var xmlstring = '<?xml version="1.0" encoding="UTF-8"?><orderlist><order><orderid>2005048</orderid></order><order><orderid>3000359</orderid></order></orderlist>';

// convert the string to an XML object
var xmlobject = (new DOMParser()).parseFromString(xmlstring, "text/xml");
// get the XML root item
var root = xmlobject.getElementsByTagName('orderlist')[0];
var orderStore = new Ext.data.XmlStore({
model: 'order',
proxy: {
storeId: 'data',
record: 'order'
autoload: true,
autosave: true

//doesn't work

//also doesn't work
for (var iNode = 0; iNode < root.childNodes.length; iNode++) {
var node = root.childNodes.item(iNode);

I have been at this for more a long time, anyone got any idea what I am doing wrong? Any help would be highly appreciated.

30 Sep 2010, 5:37 PM
You mean you'll gonna read the xml and insert it to the store?

30 Sep 2010, 5:39 PM
I don't really see why you'd do that.

Why not just use the XMLReader and load it directly using an Ajax proxy?

1 Oct 2010, 2:05 AM
I have already found a solution/ way around this. I got it working in combination with an PHP proxy and an Ajax Proxy