views:

414

answers:

3

I have a template that starts every page like this:

<?xml version="1.0" encoding="utf-8"?>
<!-- blah blah-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
...
</html>

that produces the error:

The XML page cannot be displayed Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.


The server did not understand the request, or the request was invalid. Error processing resource 'http://www.w3.org/TR/xhtm...

on IE because W3C has stopped serving the DTD.

What is the proper way to fix this?

+1  A: 

Possible Solution

I uploaded two files for you to see it in action:

  1. As HTML file: try it out, headers are text/html.
  2. As XML file try it out, headers are text/html.

the first will work in all browsers. The second will fail in IE (and work in others) because it ignores the headers of the server. The reason: the *.xml ending of the filename part. This is wrong behavior of IE, but we'll have to deal with it. If your filename ends on xml or your server sends it through as application/xml then change these settings.

Background

The resource identifier that you refer to is not a resource identifier. It is a unique identifier, a placeholder so to speak. It was never meant for being downloaded in cases of HTML being served (regardless it being XHTML as in this case). This is misbehaving IE.

The post you refer to suggests that they might take the resource offline. The DTD is still online. With other standards, they used different approaches, where the resource is not online on the same location as the identifier (same issue people have with namespaces: it is not a resource, it is an identifier).

This is not XML horror, but simply IE behaving oddly. To work with IE and XHTML, you must serve it as text/xml as MIME type. If you run it locally, you can get this error. Try to serve it differently.

NOTE: before you ask: the XML specification states that the DTD should not be downloaded, but should be seen as a unique id. Only for validating XML downloading the resource is good, but the standard says that the resource ID and the actual resource do not need to be same.

Abel
A: 

I found a post saying something similar was due to permission issues.

You might want to try the following in IE:

Hi Karl, Just guessing, what might be the problem.. Your IE's security settings are causing this error. If you check Internet options -> Security, you'll see an option "access data sources across domains". Its usually disabled. Please enable it, and see if it works..

Regards, Mukul

SOURCE: http://www.stylusstudio.com/xsllist/200412/post41070.html

I'm not sure which security concerns this option could raise.

Roberto Aloi
That setting should remain disabled. It is disabled in my IE and it doesn't suddenly start downloading DTDs or raise errors about it. Simply put: it should (and will) not download the DTD if it considers it HTML.
Abel
A: 

IE simply doesn't support XHTML.

It should have that DTD in its DTD catalog. Browsers are not supposed to actually download DTD (for practical reasons, the spec foolishly allows that).

porneL