Forum Moderators: open
So this:
"< p >Text here
< br / >And here< /p >"
Becomes:
"< p >Text here
< line >And here< /line >< /p>"
(Spaces added to prevent HTML working.)
Makes sense if you think about it, but what will happen to older browsers who view the page, such as NS4? Will we see a mix of code to ensure pages work in all browsers?
Also, will we see new XHTML-only browsers emerge?
Previously, HTML and XML were cousins, both descended from SGML. XHTML, however, is more like a second cousin of HTML, descended not from HTML but from XML.
If HTML had not already been created, we wouldn't now need the X in XHTML -- although it does mean something. X stands for "EXtensible", and hints at the main difference between HTML and XHTML.
HTML was fixed and immutable. You were restricted to the tags and attributes that were in the specs -- or, to be more accurate, you were restricted to the tags and attributes that were understood by the browsers you were targetting.
XHTML, at least in theory, opens up the possibility of adding your own tags to the DTD, or importing other DTDs.
The <html> tag has no real bearing on the language that is used. Both HTML and XHTML require that the root element of the document is <html>; that's what's in the specs. I might create an XML language called CNML (Church Newsletter Markup Language) and define the root element as <cnml> or <newsletter> or <edition> or even, if I wanted, <xyz>.
Parsing a document into a different format is a bit of a hack, it's extra work and we all know the mess you can get into by relying on a document to automatically generate markup. It's not an ideal solution. Serving up an XHTML document with a text/html MIME type may cause XHTML browsers to misbehave, since they may look at the HTTP header and switch to "HTML mode" (much like IE 6 currently has its "quirks mode"), and refuse to recognize <line> and <nl> tags.
I believe my pages might now be in Quirks Mode, as IE6 thinks the DOCTYPE is missing if you start with the XML declaration, apparently. I prefer to work in XHTML Traditional mode.
I'm now thinking about parsing XML. I can already do it with the free newsfeeds from Moreover - that's easy.
But so far there's no real need to use XML. But it'll be fun to try it out and be 'future-ready'.
mbauser2: Now I'm even more confused after reading your link. However, it does state that "text/html" "MAY" be used for XHTML 1.0 documents.
Because XHTML 1.0 was designed to be "HTML-safe". None of the other XHTML versions (1.1 and up) were designed to be HTML-compatible. They need to be served as text/xml or (preferrably) application/xml+html (which I earlier mistyped as text/xml+html), otherwise you're hiding the XML from real XML browsers.
I see XHTML in a new light now. XHTML 2 proves your point by not being backwards compatible.
And are there any XML browsers? If you load an XML document into IE6, it just displays the tags.
Yeah, if you load it by itself. An XML browser has 2 ways to parse XML formats:
1) For formats "built-in" to the browser, it can process a "naked" file, like Mozilla does with XHTML.
2) For formats that aren't native to the browser, it can process the file if the author includes an XSL [w3.org] stylesheet. Mozilla and IE6 are both pretty good with XSL, which is how Sjord Visscher got that demo page to work. (If you look at the source code of his demo page, you'll see the new elements H, NAME, and NL.)
Mozilla and IE6 aren't perfect XML browsers, but they are XML browsers.