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

Discussion in 'Javascript' started by Bjoern Hoehrmann, Jun 9, 2008.

  1. * K Viltersten wrote in comp.lang.javascript:
    >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: · 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/
     
    Bjoern Hoehrmann, Jun 9, 2008
    #1
    1. Advertising

  2. Bjoern Hoehrmann

    K Viltersten Guest

    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
     
    K Viltersten, Jun 9, 2008
    #2
    1. Advertising

  3. Bjoern Hoehrmann

    K Viltersten Guest

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

    >>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.

    > 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?

    > 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
     
    K Viltersten, Jun 10, 2008
    #3
  4. Re: Should the webserver add "Content-Type: text/xml header" to therequested XML file?

    Bjoern Hoehrmann wrote:

    > ...
    > 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:

    | 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
     
    Bart Van der Donck, Jun 12, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andy
    Replies:
    1
    Views:
    546
  2. Replies:
    8
    Views:
    1,065
    Diez B. Roggisch
    Jan 4, 2010
  3. ~~~ .NET Ed ~~~

    How should control images should be handled?

    ~~~ .NET Ed ~~~, Oct 31, 2004, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    245
    John Saunders
    Nov 3, 2004
  4. Josef 'Jupp' SCHUGT

    What the FAQs should and should not contain

    Josef 'Jupp' SCHUGT, Aug 19, 2005, in forum: Ruby
    Replies:
    0
    Views:
    198
    Josef 'Jupp' SCHUGT
    Aug 19, 2005
  5. Replies:
    5
    Views:
    84
    Charlton Wilbur
    Nov 10, 2008
Loading...

Share This Page