Click to return to the XML (Extensible Markup Language) home page    
Browsing XML Using XSL St...     Browsing XML Documents in...    
Web Workshop  |  XML (Extensible Markup Language)

Serving Up XML


XML documents can be delivered through a standard HTTP server by registering the "text/xml" MIME type on the server. Installing Microsoft® Internet Explorer 5 on the server registers the XML MIME type and associates it with the .xml and .xsl file extensions. This association is used by the Microsoft Internet Information Server (IIS) Non-MSDN Online link and the Microsoft Personal Web Server (PWS) Non-MSDN Online link to determine the MIME type.

When using either of these servers on systems that do not have Internet Explorer 5 installed, the XML MIME type can be registered by running the register-xml.reg file, which inserts the appropriate keys into the registry. The changes will not take effect until the computer has been restarted.

Alternatively, for Microsoft Internet Information Server (IIS) on systems that do not have Internet Explorer 5 installed, the XML MIME type can be registered using the Internet Service Manager console. Select Default Web Site and bring up the Properties dialog box. Select the HTTP Headers tab, click the File Types tab, select New Type, type .xml for the extension and text/xml for the Content Type, and then click OK. The .xsl extension can be registered in a similar fashion.

The .xml and .xsl extensions can also be registered to the XML MIME type manually from the File Types dialog box under Folder Options. Extensions indicating other types of XML files for purposes of browsing need to be manually registered as MIME type "text/xml".

Declaring the XML MIME Type in an Active Server Page

When generating XML dynamically using Active Server Pages, the content type must be declared in the ASP file itself. The ContentType property of the Response object indicates that the result is XML. Include this line in ASPs that are delivering XML:

<% Response.ContentType = "text/xml" %>

Important! If the XML MIME type is not registered on the server, the MIME type sent to Internet Explorer in the HTTP header will be incorrect—often "text/plain". Although Internet Explorer 5 often can detect and process these documents, conflicts can arise between the various detection algorithms. For instance, part of CDF file detection involves looking for <CHANNEL> tags—an XML document delivered with an incorrect MIME type and that uses elements named "CHANNEL" could mistakenly be handed off to the CDF processor instead of displayed as an XML document. Avoid these tricky and hard-to-debug problems by making sure your server correctly sends the XML MIME type.

Internet Explorer 5 also recognizes documents of MIME type "application/xml" as XML; see IETF RFC2376 Non-MS link.



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.