Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mime Type Validation Problem. 1

Status
Not open for further replies.

1DMF

Programmer
Joined
Jan 18, 2005
Messages
8,795
Location
GB
I've found that W3C has started warning that the mime type being served is incorrect for my X/HTML pages
Conflict between Mime Type and Document Type
The document is being served with the text/html Mime Type which is not a registered media type for the XHTML 1.1 Document Type. The recommended media type for this document is: application/xhtml+xml

So I've change IIS but it is still moaning, I've edited the .html mime type and changed it , but no dice.

1stly shoul dI be doing this ? is it ok to chenge the mime type of the .html extention to application/xhtml+xml , instead of text/html

or should we all be using a different extention for the web pages now?

such as .xhtml ?

whats the best advise,
regards,1DMF.

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Read this 1DMF


IE6 doesn't support the MIME type application/xhtml+xml. So if you want to get crazy standard specific, you have to detect the browser and set the MIME type accordingly.

IMHO, that's just a big mess, I'd just keep it as text/html OR just go to XHTML 1.0 instead of 1.1.

[monkey][snake] <.
 
I would make them HTML 4.01. There is nothing (as in zero) to be gained from using an XHTML doctype unless you are serving them as “text/xml”:
me said:
...Unless you are going to be serving your documents as “text/xml” and loading them into an XML parser to allow your XML tools to manipulate the page, then there is no reason to develop your documents as XHTML. A majority of web pages on the internet are HTML - and this should be the default choice for developing your documents - especially if your web host is serving your pages as “text/html”...
You can read the full rant about this on my blog
Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Jezus H Christ, talk about going round in circles Monksnake.

I wish I'd never heard of X/HTML at times!

I should also point out, just in case anyone is still tempted to upgrade to XHTML 1.1, that my permalinks no longer work in Netscape 4. It has nothing to do with MIME types; it’s just a general XHTML 1.1 problem. (New XHTML version 1.1! Now more hostile than ever!) Netscape 4 only recognizes anchors that use the name attribute, which no longer exists in XHTML 1.1. It exists in XHTML 1.0 but is deprecated in favor of the id attribute, which is why you see many XHTML 1.0 templates use both. In XHTML 1.1, name is gone completely. Again, SHOULD NOT got upgraded to MUST NOT. Someday, I’ll upgrade myself from SHOULD NOT chase after bleeding edge technologies that don’t solve real world problems to MUST NOT chase after bleeding edge technologies that don’t solve real world problems. But not today. Maybe after I turn 30. Until then, my only hope is that I may serve as a warning to others.

Jeff, i'm not about to go back to HTML, I've gotten used to the end tag syntax for starters, plus I like the way it forces me to think CSS , CSS all the time as well as not being able to target a new window etc..

It's made me a better coder IMO.

what's the actual implications of doing nothing? it only seems to be a warning not an error.

should I degrade to 1.0 strict? would that be a better choice? or really does it make no difference as it's still XML and the mime type would be wrong?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Here, 1DMF W3C's idea on the subject:



Based on what I read on this page, I think going XHTML 1.0 with MIME "text/html" is the way to go, at least until 90+% of browsers catch up to supporting the "application/xhtml+xml" MIME type.



[monkey][snake] <.
 
I had to stop reading, I started feeling like i was on CPAN!

But yes I got the jist, that as long as the document you are serving is purely X/HTML (webpage ie. HTML compatible)

Though you say at least until the browsers catch up, I'm using IE7 and I changed the server for .html to the application/xhtml+xml MIME type but W3C validator still moaned.

So is IIS to blame , IE7 or the W3C Validator.

And are you saying IE6, if I get the server to supply the new MIME type , it wouldn't diplay the page.

Also , should the extention on the doucment change?

surely it is wrong to have an extention of .html and issue a MIME type of XML , I see a conflict.

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Though you say at least until the browsers catch up, I'm using IE7 and I changed the server for .html to the application/xhtml+xml MIME type but W3C validator still moaned.

Take a look at this: FROM
2. Registration of MIME media type application/xhtml+xml

MIME media type name: application
MIME subtype name: xhtml+xml
Required parameters: none
Optional parameters:

charset
This parameter has identical semantics to the charset parameter
of the "application/xml" media type as specified in [XMLMIME].

schema-location
See Section 8 of this document.

Encoding considerations:
See Section 4 of this document.

Security considerations:
See Section 7 of this document.

Interoperability considerations:
XHTML 1.0 [XHTML10] specifies user agent conformance rules that
dictate behaviour that must be followed when dealing with, amoung
other things, unrecognized elements.

With respect to XHTML Modularization [XHTMLMOD] and the existence
of XHTML based languages (referred to as XHTML family members)
that are not XHTML 1.0 conformant languages, it is possible that
"application/xhtml+xml" may be used to describe some of these
documents. The HTML WG will be releasing further guidelines about
what documents should and should not be described with this type.
However, it should suffice for now for the purposes of
interoperability that user agents accepting
"application/xhtml+xml" content use the user agent conformance
rules in [XHTML1].

Although conformant "application/xhtml+xml" interpreters can
expect that content received is well-formed XML (as defined in
[XML]), it cannot be guaranteed that the content is valid XHTML
(as defined in [XHTML1]. This is in large part due to the reasons
in the preceeding paragraph.

Published specification:
XHTML 1.0 is now defined by W3C Recommendation; the latest
published version is [XHTML1]. It provides for the description of
some types of conformant content as "text/html", but also doesn't
disallow the use with other content types (effectively allowing
for the possibility of this new type).

Applications which use this media type:
Some content authors have already begun hand and tool
authoring on the Web with XHTML 1.0. However that content
is currently described as "text/html", allowing existing
Web browsers to process it without reconfiguration for a
new media type.

There is no experimental, vendor specific, or personal tree
predecessor to "application/xhtml+xml", reflecting the fact that
no applications currently recognize it. This new type is being
registered in order to allow for the expected deployment of XHTML
on the World Wide Web, as a first class XML application where
authors can expect that user agents are conformant XML 1.0 [XML]
processors.

Additional information:

Magic number:
There is no single initial byte sequence that is always present
for XHTML files. However, Section 5 below gives some guidelines
for recognizing XHTML files.

[!]File extension:
There are two known file extensions that are currently in use
for XHTML 1.0; ".xht" and ".xhtml".[/!]

It is not recommended that the ".xml" extension (defined in
[XMLMIME]) be used, as web servers may be configured to
distribute such content as type "text/xml" or "application/xml".
[XMLMIME] discusses the unreliability of this approach in
section 3.

Macintosh File Type code: TEXT

Person & email address to contact for further information:
Mark Baker <mark.baker@canada.sun.com>

Intended usage: COMMON

Author/Change controller:
The XHTML specifications are a work product of the World
Wide Web Consortium's HTML Working Group. The W3C has change
control over these specifications.


And are you saying IE6, if I get the server to supply the new MIME type , it wouldn't diplay the page.
My guess is since the page would still be written on the screen with an invalid MIME type, so maybe things like links wouldn't work.

Though you say at least until the browsers catch up, I'm using IE7 and I changed the server for .html to the application/xhtml+xml MIME type but W3C validator still moaned.

I read where IE7 doesn't support that MIME type either.



[monkey][snake] <.
 
Thanks MonkSnake,

I just bit the bullet and went through the entire site and change the pages to 1.0 strict , i'm guessing my code won't now fail on validation, i'm gonna test a few pages for now just to make sure.

Hey, I guessed the new extention all on my own ;-) , well it was pretty obvious what it should be!

I take it though I don't change it yet as technically I'm still pretending it's HTML in a way?
And can't you go easy with the information overload, it's Friday afternoon , I can taste the beer already [cheers]

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Hey , you learned, you taught, you conquered , woohoo!

And hey look at me....
This Page Is Valid XHTML 1.0 Strict!

Have a great weekend!

1DMF

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Nice 1DMF, you have a great weekend as well.

[monkey][snake] <.
 
Gratz on being strict [rofl]

I recently had to change the doctype for a whole site - I took the time to make the doctype declaration a server-side include... so I could set it in one place and allow me to quickly switch it if the need arose.

Have a good weekend!

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top