Forum Moderators: open
HTML and XHTML Frequently Answered Questions
[w3.org ]
XML Events for HTML Authors
[w3.org ]
Basic but helpful if you are new to (or wondering why) xhtml and/or xml.
And of course links that go on forever if you get interested and start reading and clicking and reading and clicking ...
Why is it disallowed to send XHTML 1.1 documents as text/html?XHTML 1.1 is pure XML, and only intended to be XML. It cannot reliably be sent to legacy browsers. Therefore XHTML 1.1 documents must be sent with an XML-related media type, such as application/xhtml+xml.
Hmmm, I remember arguing with DrDoc about this a few months ago (I lost the argument, as one tends to do with DrDoc). I thought XHTML 1.1 couldn't be served as
text/html, and he pointed out the W3C documentation showing that it could. Now this document says you can't - but it is only a FAQ, not a technical specification. So who's right now? Does anybody know for sure?
As much as I think html forms need to be improved, I don't like their suggested implementation with XForms. Now in order to create a form you need to insert data into the head tag? Are they nuts? Don't they know that there's a ton of software out there with templates that are interchangeable and the headaches of getting extra data into the head would break a lot of software.
HTML compatible XHTML1.1 doesn't exist.
That's what I thought - until DrDoc pointed out this:
[w3.org...]
Note that XHTML 1.0 and 1.1 are marked as "SHOULD NOT" be served as
text/html - as opposed to "MUST NOT". Clark - there is much debate about XForms - many people prefer the WhatWG approach [whatwg.org] rather than the official W3C one regarding forms - but it remains to be seen whether the WhatWG proposals will be adopted as a standard either by W3C (unlikely at this point) or the IETF (possible, but it's early days).
The text/html media type is now defined by W3C Recommendations; the latest published version is [HTML401]. In addition, [XHTML1] defines a profile of use of XHTML which is compatible with HTML 4.01 and which may also be labeled as text/html.
XHTML1.1 does not define a profile compatible with HTML4.01.
Also, the definition of SHOULD NOT:
SHOULD NOT This phrase, or the phrase "NOT RECOMMENDED" mean that there may exist valid reasons in particular circumstances when the particular behavior is acceptable or even useful, but the full implications should be understood and the case carefully weighed before implementing any behavior described with this label.
And that W3C link also includes "The 'text/html' media type [RFC2854] is primarily for HTML, not for XHTML. In general, this media type is NOT suitable for XHTML."
I think it's clear using text/html for XHTML is frowned upon.
XHTML 1.0 is a reformation of HTML 4 in XML 1.0 and was purposefully made a transition step that current HTML user agents could understand.
[w3.org ]
The 'text/html' media type [RFC2854] is primarily for HTML, not for XHTML. In general, this media type is NOT suitable for XHTML. However, as [RFC2854] says, [XHTML1] defines a profile of use of XHTML which is compatible with HTML 4.01 and which may also be labeled as text/html.Appendix C "HTML Compatibility Guidelines" summarizes design guidelines for authors who wish their XHTML documents to render on existing HTML user agents. The use of 'text/html' for XHTML SHOULD be limited for the purpose of rendering on existing HTML user agents, and SHOULD be limited to [XHTML1] documents which follow the HTML Compatibility Guidelines. In particular, 'text/html' is NOT suitable for XHTML Family document types that adds elements and attributes from foreign namespaces, such as XHTML+MathML
XHTML 1.1 is module based XHTML and might not be understood by current HTML user agents.
The 'application/xhtml+xml' media type [RFC3236] is the media type for XHTML Family document types, and in particular it is suitable for XHTML Host Language document types. XHTML Family document types suitable for this media type include [XHTML1], [XHTMLBasic], [XHTML11] and [XHTML+MathML].
So it is quite simple:
text/html vs. application/xhtml+xml issue at the cost of a little extra cpu load. Check if the HTTP_ACCEPT for application/xhtml+xml. If it's there, just send. Else, if it's a user agent known accept it anyway (such as the W3C's validator), again, just send it. Otherwise, do a regex to change each " />" into ">" and then send. In each case you will also need to send to send the first few lines as appropriate.
text/html, but the confusion which appears to reign within the W3C on the matter. There are links in this thread to a number of documents, all originating from w3.org, which give contradictory information. If the W3C don't even know what the standard is, then how can the rest of us hope to know what to do? It souldn't be a question of personal opinion - it should be laid out clearly in a formal specification.
If you just want to have a page that acts like html then use the 1.0 it can be sent as text/html.
If you need the exrta functionality that 1.1 offers then you CAN'T send it as text/html because the extra functionallity will not work then.
Maybe I am missing something though...