IE 找不到 W3C XHTML DTD(错误 2146697204)

发布于 2024-08-07 16:21:23 字数 759 浏览 15 评论 0原文

我有一个模板,每个页面都像这样开始:

<?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">
...
</html>

产生错误:

无法显示 XML 页面 无法使用样式查看 XML 输入 床单。请更正错误并 然后单击“刷新”按钮,或尝试 稍后再来。

<小时>

服务器不理解 请求,或者请求无效。 处理资源时出错 'http://www.w3.org/TR/xhtm...

在 IE 上,因为W3C 已停止提供 DTD

解决这个问题的正确方法是什么?

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">
...
</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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

眉目亦如画i 2024-08-14 16:21:23

可能的解决方案

我上传了两个文件供您查看其实际效果:

  1. HTML 文件: 尝试一下,标题是text/html
  2. 作为 XML 文件尝试一下,标题为 text/ html.

第一个适用于所有浏览器。第二个在 IE 中会失败(在其他浏览器中也能工作),因为它忽略了服务器的标头。原因:文件名部分的 *.xml 结尾。这是 IE 的错误行为,但我们必须处理它。如果您的文件名以 xml 结尾,或者您的服务器将其作为 application/xml 发送,则更改这些设置。

背景

您引用的资源标识符不是资源标识符。它是一个唯一的标识符,可以说是一个占位符。它从来不适合在提供 HTML 的情况下下载(无论在本例中它是 XHTML)。这是 IE 行为不当。

您提到的帖子表明他们可能使资源离线。 DTD 仍然在线< /em>。对于其他标准,他们使用不同的方法,其中资源与标识符不在同一位置在线(人们对命名空间也有同样的问题:它不是资源,而是标识符)。

这并不是 XML 的恐怖,而只是 IE 行为的奇怪。要使用 IE 和 XHTML,您必须将其作为 MIME 类型的 text/xml 提供。如果您在本地运行它,您可能会收到此错误。尝试以不同的方式提供服务。

注意:在提问之前:XML 规范规定不应下载 DTD,而应将其视为唯一的 ID。仅用于验证 XML 下载资源是否良好,但标准规定资源 ID 和实际资源不需要相同。

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.

李白 2024-08-14 16:21:23

我发现一个帖子说类似的事情是由于权限问题造成的。

您可能想在 IE 中尝试以下操作:

嗨,卡尔,
只是猜测,可能是什么问题..你的IE
安全设置导致此错误。如果你检查
互联网选项 ->安全,您会看到一个选项
“跨域访问数据源”。通常是
禁用。请启用它,看看它是否有效..

问候,
穆库尔

来源: http://www.stylusstudio.com/xsllist/200412/post41070.html

我不确定此选项可能会引起哪些安全问题。

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.

小姐丶请自重 2024-08-14 16:21:23

IE 根本不支持 XHTML。

它的 DTD 目录中应该包含该 DTD。浏览器不应该实际下载 DTD(出于实际原因,规范愚蠢地允许这样做) 。

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

乙白 2024-08-14 16:21:23

用户需要安装以下更新才能解决问题:

http://support.microsoft.com/ KB/973687/

The user needs to have the following update installed to fix the problem:

http://support.microsoft.com/kb/973687/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文