View Full Version : Content-type problem for XML in Explorer....

23 Dec 2010, 11:09 PM
Hi my friends,

Sorry for bothering again but i still couldn't solve my problem.
I am trying to read an XML file into a datastore and then show it in a html div element. It works fine in firefox or chrome but unfortunately it doesnt work in Explorer.
In everywhere, it is written that explorer cannot notice the content-type of file is xml and i need to set it manually into html response. But i really couldn't understand how to make it. Because the xml file is not producing by the server, it is just a static xml file on disk. So i need your advice so much.....Here is my code:

var submenuReader = new Ext.data.XmlReader({
record: 'Menu',
id: '@name',
fields: [
{name: 'Name', mapping: '@name'},
{name: 'Url', mapping: '@url'},
{name: 'Menu', mapping: '/'}

var dataStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: 'menu.xml',
headers: {"Content-Type": "text/xml; charset=utf-8"}
reader: new Ext.data.XmlReader({
record: 'Item',
id: 'MenuGroup',
fields: [
{name: 'Submenus', convert: function(v, n){
return submenuReader.readRecords(n).records;

dataStore.on('load', function (store, records, options) {
var tpl = new Ext.XTemplate(
'<tpl for=".">',
'<a href="#">{values.data.MenuGroup}</a>',
'<tpl for="values.data.Submenus">',
'<a href="{values.data.Url}">{values.data.Name}</a>',
tpl.overwrite(Ext.get("menu"), dataStore.getRange());


24 Dec 2010, 12:56 AM
No, don't set the content-type in the request header. It needs to be set in the response header.

Which HTTP server are you using? Apache? In that case you should configure the response header for *.xml files in the httpd.conf file (but it should already default to text/xml).

24 Dec 2010, 12:57 AM
i am using weblogic 11g

24 Dec 2010, 1:02 AM
I have no experience with WebLogic, but a quick Google turned up:

Add to web.xml: