PDA

View Full Version : [Solved]XmlReader and IE



hazlema
11 Jan 2008, 8:52 AM
Been trying to get this xml form to work for a few days and I can't figure out what is wrong. This works in Firefox but not IE. I have scowered the forums and still can't figure it out.


function initXML()
{
RecordDef = Ext.data.Record.create(
[
{name: 'description'},
{name: 'packaged'},
{name: 'price'},
{name: 'min'},
]);

myReader = new Ext.data.XmlReader(
{
record: "item",
id: "code"
}, RecordDef);

ds = new Ext.data.Store(
{
proxy: new Ext.data.HttpProxy({url: 'data/test.xml', method:'GET'}),
reader: myReader
});

ds.load();
ds.on('loadexception',function(t, o, a, ex)
{
alert('Error loading XML... - ' + a.statusText);
});

ds.on('load', function()
{
alert('Loaded OK with ' + ds.getCount() + ' records');
});
}


IE throws an exception but FF parses the xml with no problem. Here are the headers being sent back by the server when requesting the xml doc.


Content-Type text/xml
Content-Encoding gzip
Last-Modified Fri, 11 Jan 2008 16:01:04 GMT
Accept-Ranges bytes
Etag "06042b6b54c81:0"
Vary Accept-Encoding
Server Microsoft-IIS/7.0
X-Powered-By ASP.NET
Date Fri, 11 Jan 2008 16:35:45 GMT
Content-Length 1824

Everything looks ok to me. This is a stripped down version, the real one loads the xml to a combobox.

tryanDLS
11 Jan 2008, 9:14 AM
You need to call store.load after adding the handlers. What is the error?

hazlema
11 Jan 2008, 10:06 AM
You need to call store.load after adding the handlers. What is the error?

I did call ds.load();

But as for the error it says "OK" with a status of 200. I'm at a total loss here, I can only guess that maybe its the xml file itself, but ff says its ok (and I can browse to the xml directly in ie).

Heres a snipit from the xml


<?xml version="1.0" encoding="ISO-8859-1"?>
<items>
<item>
<code>18-0016-0000</code>
<description>COMPLETE BINDER SET (1 THROUGH 15)</description>
<packaged>1 BOX of 15</packaged>
<price>88</price>
<min>150</min>
<item>
</items>


There are a bunch more item records (about 60)

cerad
11 Jan 2008, 10:19 AM
IE hates extra commas. Take a look at your RecordDef code.

hazlema
11 Jan 2008, 10:28 AM
IE hates extra commas. Take a look at your RecordDef code.

Hah, can't belierve I missed that.

Thanks a bunch works great now !