HighDots Forums  

Should the webserver add "Content-Type: text/xml header" to the requested XML file?

Javascript JavaScript language (comp.lang.javascript)


Discuss Should the webserver add "Content-Type: text/xml header" to the requested XML file? in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bjoern Hoehrmann
 
Posts: n/a

Default Re: Should the webserver add "Content-Type: text/xml header" to the requested XML file? - 06-09-2008 , 04:08 PM






* K Viltersten wrote in comp.lang.javascript:
Quote:
I've been informed that a webserver sending a
XML file is supposed to add "Content-Type:
text/xml header".
This is a reference to information in the HTTP header. There are various
tools to inspect the HTTP header, for an example see The W3C web service
<http://cgi.w3.org/cgi-bin/headers?url=http://cgi.w3.org/cgi-bin/headers>.
This information isn't visible if you "View Source" in your web browser.
You have to configure your web server to generate this header, how to do
that depends on your server software and how you store the XML on it. It
would be better, to use "application/xml" instead of "text/xml" by the
way.
--
Björn Höhrmann · mailto:bjoern (AT) hoehrmann (DOT) de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/


Reply With Quote
  #2  
Old   
K Viltersten
 
Posts: n/a

Default Should the webserver add "Content-Type: text/xml header" to the requested XML file? - 06-09-2008 , 04:16 PM






I've been informed that a webserver sending a
XML file is supposed to add "Content-Type:
text/xml header".

I'm not questioning that infromation but i'm
unsure what was ment by it. The XML i get on
my screen when i type in the url to it looks
as follows.

<?xml version="1.0" encoding="UTF-8"?>
<tag-uno>uno</tag-uno>
<tag-duo>duo</tag-duo>

I can't see any line containing "text/xml"
but perhaps it's not supposed to show in the
requested file. Please advise.

--
Regards
Konrad Viltersten
--------------------------------
sleep - a substitute for coffee for the poor
ambition - lack of sense to be lazy


Reply With Quote
  #3  
Old   
K Viltersten
 
Posts: n/a

Default SV: Should the webserver add "Content-Type: text/xml header" to the requested XML file? - 06-10-2008 , 12:04 AM



Quote:
I've been informed that a webserver sending a
XML file is supposed to add "Content-Type:
text/xml header".

This is a reference to information in the HTTP
header. There are various tools to inspect the
HTTP header, for an example see The W3C web
service <http://cgi.w3.org/cgi-bin/headers?
url=http://cgi.w3.org/cgi-bin/headers>.
This information isn't visible if you "View
Source" in your web browser.
Thanks for the answer. I believe i'm starting
to grasp the cause of the issue now. Still,
there are two things i'm unclear about.

Quote:
You have to configure your web server to
generate this header, how to do that depends
on your server software and how you store the
XML on it.
The server is something that MS VWD starts
automatically when i choose to view a HTML in
the browser. I really, really have no clue how
to configure it. Is it something specific to
MS SQL Server?

Quote:
It would be better, to use "application/xml"
instead of "text/xml" by the way.
Why? (I'm not arguing against the statement.
Just want to understand.)

--
Regards
Konrad Viltersten
--------------------------------
sleep - a substitute for coffee for the poor
ambition - lack of sense to be lazy



Reply With Quote
  #4  
Old   
Bart Van der Donck
 
Posts: n/a

Default Re: Should the webserver add "Content-Type: text/xml header" to therequested XML file? - 06-12-2008 , 03:05 AM



Bjoern Hoehrmann wrote:

Quote:
...
You have to configure your web server to generate this header, how to do
that depends on your server software and how you store the XML on it. It
would be better, to use "application/xml" instead of "text/xml" by the
way.
In the OP's case, 'text/xml' should be used when offering an XML-file
to the browser, regardless of how the XML-data itself was generated at
the server.

http://www.ietf.org/rfc/rfc3023.txt says:

Quote:
If an XML document -- that is, the unprocessed, source XML document
-- is readable by casual users, text/xml is preferable to
application/xml.
Nevertheless Apache seems to prefer 'application/xml' when nothing
else is specified.

--
Bart


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.