Closed
Bug 116321
Opened 24 years ago
Closed 24 years ago
File extension overrides DOCTYPE
Categories
(SeaMonkey :: General, defect)
Tracking
(Not tracked)
VERIFIED
INVALID
People
(Reporter: David, Assigned: asa)
Details
Attachments
(2 files)
XML Parsing Error: syntax error
is returned if the file extension is "XHTML" even if the DOCTYPE is
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
Mozilla 0.9.5
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.5) Gecko/20011213
The sample content validates at http://validator.w3.org/check
Internet Explorer 6.0.2600 renders the content even if the file has an xhtml
extension. This does not mean it's the right thing to do!
Sample content:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Some title</title>
</head>
<body>
<p>Some HTML</p>
</body>
</html>
Comment 1•24 years ago
|
||
The server is probably picking up on the file extension and serving the document
with a MIME-type of application/xhtml+xml or text/xml. Actual MIME headers
override HTTP headers specified in the document. Do you have a testcase of this
online? DOCTYPE sniffing only applies for documents within the text/html MIME-type.
Reporter | ||
Comment 2•24 years ago
|
||
Sorry, I should have mentioned that in this case I was opening the file
directly from the file system by dragging it from Windows Explorer onto the
render area of Mozilla.
Reporter | ||
Comment 3•24 years ago
|
||
I have explicitly set the content type to HTML when adding this attachment
Reporter | ||
Comment 4•24 years ago
|
||
This has been submitted with auto-detect for the content-type
Reporter | ||
Comment 5•24 years ago
|
||
Both of the test attachments work fine as the content type has been explicitly
noted by BugZilla. I'm not sure about what other tests I can perform as I don't
have control over a public web server for you to link to.
Reporter | ||
Comment 6•24 years ago
|
||
Have just tried this on IIS 5. The MIME type is listed as application/xhtml+xml
as you would expect. When connecting to the webserver I got the "What
application should I use?" dialog box. This didn't happen when I loaded the
same file from the file system (I connected to the file system of the remote
machine to test remoting issues).
I've opened up my IIS Server for you to have a look (these are the same file):
http://myforest.dns2go.com/Extension.xhtml
and
http://myforest.dns2go.com/Extension.html
Oh well, guess I'll re-build it in the morning!
Comment 7•24 years ago
|
||
OK, here's what I assume is happening. The file on your local system has a
.xhtml extension. When Mozilla sees the file extension, it assumes the document
will be XHTML, *and treats it as if it were XML, not HTML*, because not all
XHTML can be classified as text/html. (Appendix C of XHTML 1.0). So by the
time the parser gets to the DOCTYPE, the document is already loaded as XML, and
it throws an XML error. DOCTYPE sniffing is an institution peculiar to
text/html or files identified as such (.html, .htm).
(And your webserver is now serving the .xhtml file as application/octet-stream,
FWIW).
Comment 8•24 years ago
|
||
And the browser won't start if I rename mozilla.exe into mozilla.txt --
XHTML is an XML markup. We treat .xhtml as such from a filesystem. Your file
is clearly not XHTML. Why name it with that extension in the first place? If
you drop that file onto any recent server, it will serve it with an XML
mimetype. Isn't it safe for us to assume that it is XML as well?
URL: None
Reporter | ||
Comment 9•24 years ago
|
||
>>Why name it with that extension in the first place<<
It was an accident.
I can understand what you're saying and am happy to go with that approach. I
don't have enough familiarity with XHTML yet to know any better. As the file
system doesn't indicate the MIME type, it's neccessary to make some assumptions
and what you've detailed makes sense.
Thanks for your help.
Status: UNCONFIRMED → RESOLVED
Closed: 24 years ago
Resolution: --- → INVALID
Updated•21 years ago
|
Product: Browser → Seamonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•