?? Firefox 1.0.7 Chokes on& nbsp; ?? [英] ?? Firefox 1.0.7 Chokes on   ??

查看:51
本文介绍了?? Firefox 1.0.7 Chokes on& nbsp; ??的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我有一个非常简单的页面,Firefox有问题:
www.absolutejava.com/testing.htm


首先,这个页面似乎完全有效XHTML严格。

W3C验证器以及Page Valet表明它是有效的。页面

使用正确的MIME类型application / xhtml + xml提供。


不幸的是,Firefox将不会显示页面XHTML中的不间断

空格(& nbsp;)。我也在使用

XHTML DTD的本地定制版本。


让我快速解释一下自定义DTD问题 - DTD I''使用的是

*完全*与在
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd ,除了我

允许锚(< a>)元素上的''target''属性。但是

这不是造成问题的原因。问题来自于

字符助记符实体。由我的自定义DTD导入。但是

这些是由真实的

XHTML严格DTD导入的相同助记实体,所以应该没问题。


出于某种原因,似乎Firefox忽略了这些助记符实体,

,例如& nbsp;。有没有人知道为什么Firefox不会尊重我的DTD导入的角色实体?
?如果可以,请查看XHTML

代码以及DTD。


有三个字符助记符实体。由DTD导入

(xhtml-lat1.ent,xhtml-symbol.ent和xhtml-special.ent),每一个

我已经复制到我自己的DTD中目录:


<!ENTITY%HTMLlat1 PUBLIC

" - // W3C // ENTITIES Latin 1 for XHTML // EN"

" xhtml-lat1.ent">

%HTMLlat1;


<!ENTITY%HTMLsymbol PUBLIC

" - // W3C // ENTITIES符号XHTML // EN"

" xhtml-symbol.ent">

%HTMLsymbol;


<!ENTITY%HTMLspecial PUBLIC

" - // W3C // ENTITIES特别为XHTML // EN"

" xhtml-special.ent">

%HTMLspecial;

解决方案

rbronson1976写道:

XHTML中的不间断空格(& nbsp;)。


你显然知道这里有什么问题,你为什么要问我们?


首先,这个页面似乎是完全有效的XHTML严格。


不是。

两者都是W3C验证器和Page Valet表明它是有效的。


他们不是XHTML验证器,他们是SGML验证器。因此,在这种情况下,他们会给出

误导性结果。

页面
正在以适当的MIME类型application / xhtml + xml提供。


这是一个坏主意 - 如果你真的想要它在网上工作,那就把它作为text / html服务吧。网络已经为XHTML做好了准备,但它还没有为

XHTML作为application / xhtml + xml做好准备,即使它更正确。

不幸的是,由于


,Firefox不会显示页面那是因为它不是一个格式良好的页面。

我也在使用XHTML DTD的本地自定义版本。




人们会想知道为什么?为什么你会期望这有机会在网上工作?


rbronson1976写道: www.absolutejava.com/testing.htm

首先,这个页面似乎是完全有效的XHTML Strict。


这不是XHTML。 XHTML规范要求使用三个

DOCTYPE声明中的一个,而你的声明不是其中之一。


这是一个有效的XML文档,虽然。

W3C验证器和Page Valet都表明它是有效的。


W3C验证器说:

此页有效 - // ABSJAVA // DTD XHTML 1.0严格与目标// EN! br />
这是毫无意义和误导性的唠叨,因为它只是从DOCTYPE声明中获取了一个字符串

。它_should_简单地说文件

是一个有效的XML文档。

页面
正在以适当的MIME类型application / xhtml +提供XML" ;.


这不是一个合适的类型,因为该文件不是XHTML。

不幸的是,Firefox不会显示页面因为非打破XHTML中的空格(& nbsp;)。我正在使用
XHTML DTD的本地自定义版本。
- - 有三个字符助记符实体。由DTD导入
(xhtml-lat1.ent,xhtml-symbol.ent和xhtml-special.ent),每个都已复制到我自己的DTD目录中:




我担心Firefox处理外部

声明的方式有限制。此外,XML浏览器并不是真的需要阅读这样的

声明。


但不是想知道出了什么问题以及如何修复它,为什么

你不是只是停止使用实体引用吗?由于你使用的是
UTF-8,你不需要这些实体,除非是由于

创作软件的缺陷。您可以简单地编写不间断空格。它甚至可以节省空间(两个八位字节对六个)。
甚至可以节省空间。如果你真的不能这样做,你可以使用字符实体参考&#xa0;。


Andy Dingley写道:

rbronson1976写道:

XHTML中的一个不间断的空格(& nbsp;)。
你显然知道什么是错的在这里,你为什么要问我们?




因为使用& nbsp; *应该管用。应该@copy;。

首先,这个页面似乎是完全有效的XHTML Strict。
它不是。




好​​的,从技术上讲,它不是XHTML严格的,因为我引用了一个已调整的

自定义DTD(我在其中添加了一个''target''属性

< a>元素)。但该页面甚至没有使用我所做的调整。

对于所有意图和目的,我可以将XHTML Strict DTD

复制到我的本地服务器中逐字(没有调整)我会得到

得到同样的错误。


这个问题似乎根源于Firefox没有$ /
在遇到

a自定义DTD时正确解析外部实体。

两者都是W3C验证器以及Page Valet表明它是有效的。



它们不是XHTML验证器,它们是SGML验证器。所以他们在这种情况下给出了误导性的结果。




好​​吧,我的理解是他们将在XML模式下验证

提供XML内容类型,因为我有(application / xhtml + xml)。

页面
正在提供正确的MIME类型application / xhtml + xml。



这是一个坏主意 - 如果你真的希望它能够工作,那就把它作为text / html服务网络。网络已经为XHTML做好了准备,但它还没有为
XHTML作为application / xhtml + xml做好准备,即使它更正确。



我将它作为''application / xhtml + xml''提供给验证者进入XML

模式。此外,Firefox处理更合适的内容类型

''application / xhtml + xml''完全没问题。最后,我会将

切换回''text / html'',作为对IE 6的让步。

遗憾的是,由于



,Firefox不会显示该页面。这是因为它不是一个格式良好的页面。




当然可以。告诉我关于它的内容不是很好。

我也使用XHTML DTD的本地自定义版本。


有人会想知道为什么?为什么你会期望这有机会在网上工作?




是的,我当然会。内容类型(''application / xhtml + xml'')是

告诉Firefox如何呈现它。


Hi all,

I have a very simple page that Firefox has problems with:
www.absolutejava.com/testing.htm

First of all, this page seems to be perfectly valid XHTML Strict. Both
the W3C validator as well as Page Valet indicate it is valid. The page
is being served with the proper MIME type of "application/xhtml+xml".

Unfortunately, Firefox will not display the page due to a non-breaking
space (&nbsp;) in the XHTML. I am using a local, custom version of the
XHTML DTD as well.

Let me explain the custom DTD issue quickly -- the DTD I''m using is
*EXACTLY* the same as the XHTML Strict DTD found at
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd, except that I
allowed for a ''target'' attribute on the anchor (<a>) element. But
that''s not what''s causing the problem. The problem is coming from the
"Character mnemonic entities" that are imported by my custom DTD. But
these are the same mnemonic entities that are imported by the real
XHTML Strict DTD, so it should be okay.

For some reason, it seems Firefox is ignoring these mnemonic entities,
such as &nbsp;. Does anyone have an idea why Firefox will not respect
the character entities imported by my DTD? Please look at the XHTML
code as well as the DTD, if you can.

There are three "Character mnemonic entities" imported by the DTD
(xhtml-lat1.ent, xhtml-symbol.ent and xhtml-special.ent), each of which
I have copied into my own DTD directory:

<!ENTITY % HTMLlat1 PUBLIC
"-//W3C//ENTITIES Latin 1 for XHTML//EN"
"xhtml-lat1.ent">
%HTMLlat1;

<!ENTITY % HTMLsymbol PUBLIC
"-//W3C//ENTITIES Symbols for XHTML//EN"
"xhtml-symbol.ent">
%HTMLsymbol;

<!ENTITY % HTMLspecial PUBLIC
"-//W3C//ENTITIES Special for XHTML//EN"
"xhtml-special.ent">
%HTMLspecial;

解决方案

rbronson1976 wrote:

a non-breaking space (&nbsp;) in the XHTML.
You obviously know what''s wrong here, so why are you asking us?

First of all, this page seems to be perfectly valid XHTML Strict.
It isn''t.
Both
the W3C validator as well as Page Valet indicate it is valid.
They''re not XHTML validators, they''re SGML validators. So they give
misleading results in this case.
The page
is being served with the proper MIME type of "application/xhtml+xml".
That''s a bad idea - serve it as text/html if you actually want it to
work on the web. The web is ready for XHTML, but it''s not yet ready for
XHTML served as application/xhtml+xml, even if that is more "proper".

Unfortunately, Firefox will not display the page due to
That''s because it''s not a well-formed page.

I am using a local, custom version of the XHTML DTD as well.



One would wonder why? And why you''d expect this to stand any chance of
working on the web?


rbronson1976 wrote:

I have a very simple page that Firefox has problems with:
www.absolutejava.com/testing.htm

First of all, this page seems to be perfectly valid XHTML Strict.
It isn''t XHTML. The XHTML specification requires the use of one of three
DOCTYPE declarations, and yours isn''t one of them.

It is a valid XML document, though.
Both
the W3C validator as well as Page Valet indicate it is valid.
The W3C validator says:
"This Page Is Valid -//ABSJAVA//DTD XHTML 1.0 Strict With Target//EN!"
That''s pointless and misleading babble, since it just picks up a string
from the DOCTYPE declaration. It _should_ simply say that the document
is a valid XML document.
The page
is being served with the proper MIME type of "application/xhtml+xml".
It isn''t a proper type, since the document isn''t XHTML.
Unfortunately, Firefox will not display the page due to a non-breaking
space (&nbsp;) in the XHTML. I am using a local, custom version of the
XHTML DTD as well. - - There are three "Character mnemonic entities" imported by the DTD
(xhtml-lat1.ent, xhtml-symbol.ent and xhtml-special.ent), each of which
I have copied into my own DTD directory:



I''m afraid there are limitations in the way Firefox handles external
declarations. Besides, XML browsers aren''t really required to read such
declarations.

But instead of wondering what goes wrong and how it might be fixed, why
don''t you simply stop using entity references? Since you are using
UTF-8, you don''t need the entities, except perhaps due to flaws in the
authoring software. You can simply write the no-break space as such. It
even saves space (two octets vs. six). If you really can''t do that, you
can use the character entity reference &#xa0;.


Andy Dingley wrote:

rbronson1976 wrote:

a non-breaking space (&nbsp;) in the XHTML.
You obviously know what''s wrong here, so why are you asking us?



Because using a &nbsp; *should* work. As should @copy;.

First of all, this page seems to be perfectly valid XHTML Strict.
It isn''t.



Okay, technically, it''s not XHTML Strict because I am referencing a
custom DTD that has been tweaked (I added a ''target'' attribute to the
<a> element). But the page does not even make use of the tweak I made.
For all intents and purposes I could have copied the XHTML Strict DTD
to my local server verbatim (without the tweak) and I would have
gotten the same error.

The problem seems to be rooted in the fact that Firefox does not
resolve the external entities correctly, or at all, when it encounters
a custom DTD.

Both
the W3C validator as well as Page Valet indicate it is valid.



They''re not XHTML validators, they''re SGML validators. So they give
misleading results in this case.



Well, my understanding is that they will validate in XML mode when
served with an XML content-type, as I have (application/xhtml+xml).

The page
is being served with the proper MIME type of "application/xhtml+xml".



That''s a bad idea - serve it as text/html if you actually want it to
work on the web. The web is ready for XHTML, but it''s not yet ready for
XHTML served as application/xhtml+xml, even if that is more "proper".



I serve it as ''application/xhtml+xml'' to get the validators into XML
mode. Also, Firefox handles the more proper content-type of
''application/xhtml+xml'' perfectly fine. Eventually, I will switch back
to ''text/html'', as a concession to IE 6.

Unfortunately, Firefox will not display the page due to



That''s because it''s not a well-formed page.



Sure it is. Tell me what''s not well formed about it.

I am using a local, custom version of the XHTML DTD as well.



One would wonder why? And why you''d expect this to stand any chance of
working on the web?



Yes, Of course I would. The content type (''application/xhtml+xml'') is
telling Firefox how to render it.


这篇关于?? Firefox 1.0.7 Chokes on&amp; nbsp; ??的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆