Welcome to WebmasterWorld Guest from 50.19.190.144

Forum Moderators: incrediBILL

Message Too Old, No Replies

Two New W3C Documents: 21 July 2004

Intro to and the why of xhtml and xml

     
3:58 am on Jul 22, 2004 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 25, 2003
posts:891
votes: 59


Two new "overview" type documents from W3C:

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

5:57 am on July 22, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:June 16, 2004
posts:70
votes: 0


Nice find

Some interesting info in the articles.

7:07 am on July 22, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 4, 2002
posts:666
votes: 0


Theres a nice little trick in the first one to get around the application/xhtml+xml issue with Internet Explorer.
12:05 pm on July 22, 2004 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 31, 2003
posts:9063
votes: 2


From the first document:

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?

12:11 pm on July 22, 2004 (gmt 0)

Full Member

10+ Year Member

joined:Mar 8, 2004
posts:311
votes: 0


You can send XHTML1 as text/html (with conditions, such as using <br /> instead of <br/>).

XHTML1.1 should not be sent as text/html. HTML compatible XHTML1.1 doesn't exist.

12:32 pm on July 22, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 8, 2002
posts:2335
votes: 0


Interesting links which I followed to here:
[w3.org...]

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.

1:26 pm on July 22, 2004 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 31, 2003
posts:9063
votes: 2


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

2:09 pm on July 22, 2004 (gmt 0)

Full Member

10+ Year Member

joined:Mar 8, 2004
posts:311
votes: 0


However RFC 2854 "The text/html media type":
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.

2:45 pm on July 22, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 8, 2002
posts:2335
votes: 0


encyclo, I'll look at that link. I don't know about w3c and any other org, but it will interest me when at least Opera or Mozilla enable such use in their browser. This very box I'm typing in should have more flexibility.
7:45 pm on July 22, 2004 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 25, 2003
posts:891
votes: 59


There appears to be some confusion:

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:

  1. use of xhtml 1.0 and "text/html" is fine. No problem.
  2. use of xhtml 1.1 and "text/html" is not fine.
    • which may cause XML user agents to display incorrectly (as well-formed code is necessary they may well refuse to display anything);
    • and HTML user agents may display incorrectly due to unrecognised code.

  3. use of either xhtml 1.0 or xhtml 1.1 and "application/xhtml+xml" (or similar)
    • HTML user agents will probably be unable to display correctly.
    • XML user agents will have no problem.


so
use XHTML 1.0 and "text/html" (like many of us do) which displays just fine and wait on replacement xml user agents to become popular before switching to XHTML 1.1.
9:40 pm on July 22, 2004 (gmt 0)

Full Member

10+ Year Member

joined:Dec 25, 2003
posts:269
votes: 0


There is a very simple solution for the
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.

9:45 pm on July 22, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 17, 2001
posts:1262
votes: 0


D'oh, we'd relied on [xml.com...] which says 1.0 may, 1.1 should not, and 2.0 must.
12:10 am on July 23, 2004 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 31, 2003
posts:9063
votes: 2


The problem is not whether one should or shoudn't send XHTML 1.1 as
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.

12:33 am on July 23, 2004 (gmt 0)

Full Member

10+ Year Member

joined:Dec 25, 2003
posts:269
votes: 0


If the W3C don't even know what the standard is, then how can the rest of us hope to know what to do?
Good point, but if you always serve the "correct" type the problem is avoided. As far as UA's who can't handle XHTML, send them an HTML version.
1:14 am on July 23, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:June 16, 2004
posts:70
votes: 0


I don't think it really matters if you CAN send 1.1 as text/html because by doing so you loose basically all the extra functionallity that it has.

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

9:45 pm on July 30, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


All this confusion is why I am still sticking to HTML 4.01 for the forseeable future.....