Jump to content

Are you REALLY using valid code, or just getting "validated"?


dbrimlow

Recommended Posts

Okay, I have finally been convinced of the correct answer to the whole XHTML vs. HTML debate that has been raging for years ... HTML is correct and XHTML is wrong. XHTML may actually become a dinosaur.

 

Here's why. Most of us who thought we were using valid html or xhtml are wrong. Unless you've been using the HTML 4.0 Strict DTD, your code, no matter how well crafted and markup style-free, is NOT valid code ... it "validates" under the Transition DTD, but transitional DTD is not "VALID" HTML.

 

Those of you using HTML transitional, try this. Change transitional to strict. Then test if it is valid at the w3c validation tool. If it validates, get rid of the stupid transitional and keep it as strict. If it doesn't validate, however, promptly remove those cool little "valid html" buttons on the bottom of your page.

 

Now for the real killer. NEITHER XHTML Transitional nor XHTML Strict is valid if it is served using the mime-type "text/html".

 

The w3c says XHTML 1.0 transitional CAN be served with the text/html mime-type, but it is NOT valid XHTML unless it IS served with the "application/xhtml+xml" mime-type.

 

XHTML was abused and never should have had a transitional DTD and it never should have been able to be served under the text/html mime-type.

 

So that brings us back to why I have been converted. I now have to go back to all of those pages that I slaved over for nearly two years, converting from no doctype quirks mode tag-soup to beautifully crafted XHTML transitional - change them all to HTML Strict, re-validate (and subsequently fix) them to be VALID HTML 4.0.

 

Swell, just in time for the new HTML 5.0 and all the debate starting up about THAT!!!

 

 

 

 

 

Link to comment
Share on other sites

What you are saying doesn't even make sense, and is in the CSS board.  Code must validate to the doctype, if it does, then it is valid for the declared doctype, end of story. Saying xhtml will be a dinosaur doesn't make sense either.  XHTML was made to move people towards XML syntax.

Link to comment
Share on other sites

Ah Ha! Not four days ago I would have made the same argument, guys. This debate has been going on for a while now, and I always firmly stood in the "if it validates, it is valid for that DTD!" camp.

 

I would have posted a blistering response to my post and the logic would have seemed so indisputable that you would have joined me in signing my praise for "killing this "poser"".

 

But I (and you) was wrong. And it is something you are going to have to face, as I did (kicking and screaming). You will eventually HAVE to acknowledge it as true (even if you don't think so now). I can be as stubborn as the next guy, but when actually proven that am wrong, however distasteful, I have to give in.

 

Transitional DTD does NOT make valid html or xhtml. It validates the code based upon it being a transition to PROPER, VALID HTML or XHTML.

 

Here are a few links that were rammed down my throat during a heating argument in another forum for web standard coding professionals (which FORCED me to acknowledge, however distasteful it always is, that I was wrong and they were right):

 

Best references on that issue, READ THEM TO OPEN YOUR EYES, are:

 

XHTML's Dirty Little Secret by Mark Pilgrim

http://www.xml.com/pub/a/2003/03/19/dive-into-xml.html

 

Beware of XHTML

http://www.webdevout.net/articles/beware_of_xhtml.php

is also a very complete document on the issue.

It even lists quotes from Browser Manufacturers:

 

"Serving valid HTML 4.01 as text/html ensures the widest browser and search engine support."

Mozilla Web Developer FAQ

http://www.mozilla.org/docs/web-developer/faq.html#accept

 

Safari Developer FAQ

http://developer.apple.com/internet/safari/faq.html#anchor13

 

"On today's web, the best thing to do is to make your document HTML4 all the way. Full XHTML processing is not an option, so the best choice is to stick consistently with HTML4."

Safari developer Maciej Stachowiak

http://webkit.org/blog/?p=68

 

"I don't think XHTML is a realistic option for the masses. HTML5 is it."

Håkon Wium Lie, CTO of Opera

http://www.heise.de/ct/Redaktion/heb/w3c/lie_english.html

 

etc...

 

http://www.webdevout.net/articles/beware-of-xhtml#quotes

 

No to XHTML

http://www.spartanicus.utvinternet.ie/no-xhtml.htm

which explains the misconceptions, exaggerations regarding XHTML. This is the best document on this issue.

 

XHTML is dead by Tommy Olsson

http://www.autisticcuckoo.net/archive.php?id=2005/03/14/xhtml-is-dead

 

XHTML - What's the point? by Henri Sivonen

http://hsivonen.iki.fi/xhtml-the-point/

 

XHTML is not for Beginners by Lachlan Hunt

http://lachy.id.au/log/2005/12/xhtml-beginners

Link to comment
Share on other sites

#

 

All of your pages must be well-formed XML. Technically, they don't need to be valid XHTML (you could have a <div> element inside a <span> element and be well-formed but invalid). But all your end tags must match all your start tags, no overlaps, none missing.

 

When I say must, I mean must. Mozilla and its derivatives are the only major browsers that can handle the XHTML MIME type (more on that in a minute), and they are ultra-strict about it. If a single end tag is missing, Mozilla users won't see your page at all; they'll see an XML debugging message instead.

 

Your argument is actually very interesting. And although I would have loved to argue with you, I'm not going to. All I wanted to is emphasize that quote....

 

Sure I want valid (super valid) XHTML, but if I forget to valid even one page than mozilla would throw out an error? I don't want that.

Link to comment
Share on other sites

The key to the whole thing is in the mime type.

 

If you are serving xhtml as a "text/html" mime type (weather you use Strict or Transitional DTD), then you are, in essence, serving up the page as HTML!

 

XHTML is NOT, nor was it ever meant to be, an HTML replacement.

 

XHTML was meant, and is valid in strict mode, as an application in order to display the results of an XML file. As such it is MEANT to use the "application/xhtml+xml" mime-type and NOT "text/html".

 

So, using XHTML as an html replacement is meaningless because it is merely being served as HTML with strange closing tags. But make no mistake ... it IS being served as HTML and NOT XHTML.

 

There is no argument there ... it is simply a fact.

 

AND, I believe XHTML 2.0 will no longer be backwards compatible with the text/html mime type anyway. So there is no point in using xhtml transitional, because it is NOT XHTML, it is HTML with funny tags allowed.

 

What it comes down to, for me anyway, is that it took me a long time to convert my old tag soup quirks mode html to what I thought was Valid code. Yet using the Transitional DTD for XHTML or HTML was an exercise in futility.

 

Because VALID HTML 4.0 will only validate using the Strict DTD.

Link to comment
Share on other sites

LOL, yeah, it feels like that.

 

Try this on just one of your pages.

 

Change your DOCTYPE to HTML Strict. Go ahead and remove the xhtml style closed meta tags, images and breaks.

 

Then go to the validation tool. It should validate. This would prove that your xhtml was basically just html (with a few strange tags). It is not xhtml because it is not parsing an xml file, it is not behaving as xhtml should ... it is behaving as html.

 

It isn't a matter of good or bad, it is a matter of intent. The correct language for using a text/html mime-type is ... html. Period.

 

The correct use of XHTML is when it is using the application/xhtml+xm mime-type.

 

Here is how I can put it into perspective:

 

If you create a web page using html and save it with a php extension, is it an actual php page?

 

No, it is an html page with a php extension that displays html. The php extension doesn't REQUIRE actual php code present to display as html.

 

It WOULD be an actual php page if it included server-side php code that output html based upon php commands it was given in the code. However, if you saved the php page,  with the php code included, as an html extension, what would happen? BOOM! Garbage.

 

 

Link to comment
Share on other sites

I don't get the big fuss. XHTML 1.0 Strict was made with the intention of allowing it to be served as text/html. The W3C even have it as their primary template example - http://www.w3.org/QA/2002/04/valid-dtd-list.html - and use xhtml 1.0 strict served as text/html for their own website. In addition, when people are looking to use mootools (for example) then you need to be serving xhtml 1.0 as text/html. A lot of people doing this are fully aware of what is going on (i.e., xhtml should not ideally be served as html, and html should use an html doctype) but for the sake of practicality they are not always going to use HTML 4.01 strict. If the world ever did come to an end, converting to html 4.01 strict is simple.

 

I also think that your php/html analogy is misleading.

 

The use of a transitional doctype is another issue.

Link to comment
Share on other sites

hold on a minute - why is xhtml going to die out????

 

I use xhtml 1.1 and it does wonders for my sites...

 

was teh big deal of teh content type??? just set it to application/xhtml+xml - there job done.  Browsers then know what they are dealing with.

 

IMO xhtml is fantatsic (thats why I use it) and although I don't bother with all the valid xhtml/css/wcga emblmes I do code to meet the criteria.  Safe in teh knowledge that my sites are now forward compatible I sleep very well.

 

PLUS the efect xhtml1.1 has on ie6 and how it renders - no probs with absolute positioning (bar z-index everynow and then).

 

xhtml is the future html5 will be a bag of wbank - trust me;)

Link to comment
Share on other sites

All I can say guys, is read the links. Don't just argue without fully understanding the implications (like I always did). Read the links! I am not trying to be arbitrary ... I am trying to warn you all that you are NOT writing valid code when you use transitional and that serving XHTML 1.0 as text/html is going to bite you on the ass once xhtml 2.0 comes out and the w3c stops validating any text/html served xhtml. They made a mistake! And they now admit it! And I am just as bummed as you - once I accepted the truth.

 

was teh big deal of teh content type??? just set it to application/xhtml+xml - there job done.  Browsers then know what they are dealing with.

 

"Internet Explorer does not support XHTML. Like other web browsers, when a document is sent as text/html, it treats the document as if it was a poorly constructed HTML document. However, when the document is sent as application/xhtml+xml, Internet Explorer won't recognize it as a webpage; instead, it will simply present the user with a download dialog. This issue still exists in Internet Explorer 7.

 

Although all other major web browsers, including Firefox, Opera, Safari, and Konqueror, support XHTML, the lack of support in Internet Explorer as well as major search engines and web applications makes use of it very discouraged.

 

Using XHTML does not encourage better support by web browsers and it is not “a vote for a better Web” if you are still supporting Internet Explorer and various search engines and other user agents which require text/html. If you serve it with the typical text/html content type, you are giving all browsers a thumbs-up to treat it exactly like classic HTML, meaning absolutely no progress is made. Even if you use only application/xhtml+xml and shut out Internet Explorer and various other user agents entirely, it won't mean anything: Microsoft already plans to support real XHTML in an upcoming release of Internet Explorer; they just want to make sure they support it correctly from the initial launch. Even still, XHTML 1.x is a dead-end standard, since it's completely incompatible with XHTML 2.0 and all other future HTML/XHTML standards, as explained aboved, and since the majority of XHTML content on the Web today cannot be safely parsed as XML."

 

I don't get the big fuss. XHTML 1.0 Strict was made with the intention of allowing it to be served as text/html. The W3C even have it as their primary template example - http://www.w3.org/QA/2002/04/valid-dtd-list.html - and use xhtml 1.0 strict served as text/html for their own website. In addition, when people are looking to use mootools (for example) then you need to be serving xhtml 1.0 as text/html. A lot of people doing this are fully aware of what is going on (i.e., xhtml should not ideally be served as html, and html should use an html doctype) but for the sake of practicality they are not always going to use HTML 4.01 strict. If the world ever did come to an end, converting to html 4.01 strict is simple.

 

When the XHTML 1.0 specification was first written, there were provisions that allowed an XHTML document to be sent as text/html as long as certain compatibility guidelines were followed. The idea was to ease migration to the new format without breaking old user agents. However, these provisions are now viewed by many as a mistake. The whole point of XHTML is to be an XML alternative to HTML, yet due to the allowance of XHTML documents to be sent as text/html, most so-called XHTML documents on the Web now would break if they were treated like XML (see the real-world examples in http://www.webdevout.net/articles/beware_of_xhtml.php). Aware of the problem, the W3C had these provisions removed in the first revision of the XHTML specification. In XHTML 1.1 and onward, the W3C now clearly says that an XHTML document should not be sent as text/html. XHTML should be sent as application/xhtml+xml or one of the more elaborate XHTML content types.

Link to comment
Share on other sites

All I can say guys, is read the links. Don't just argue without fully understanding the implications (like I always did). Read the links! I am not trying to be arbitrary ... I am trying to warn you all that you are NOT writing valid code when you use transitional and that serving XHTML 1.0 as text/html is going to bite you on the ass once xhtml 2.0 comes out and the w3c stops validating any text/html served xhtml. They made a mistake! And they now admit it! And I am just as bummed as you - once I accepted the truth.

 

I read the links. Their concern is with what happens to xhtml 1.0 sites when they are served as application/xhtml+xml rather than text/html. The reality is that xhtml 1.0 allows you to serve as text/html and that when xhtml 2.0 comes out it won't make a blind bit of difference to what happens when xhtml 1.0 doctypes are used to serve text/html. When Javascript libraries like Mootools require an xhtml doctype, people are going to use one! When xhtml 2.0 and html 5 are finally "out" (and the issues resolved) those xhtml 1.0 strict websites are not suddenly going to stop working.

 

For me, it would also not be much work to migrate xhtml to html and my use of mootools is strictly to enhance the user experience anyway. I get the point being made, I see what they are saying about xhtml, I acknowledge the cons of using xhtml 1.0 strict to serve text/html...but I'll use xhtml where necessary.

 

Using transitional doctypes is another issue...and besides, you shouldn't be missing out the xmlns attribute when using xhtml doctypes.

Link to comment
Share on other sites

You guys can do whatever you like, the fact that it IS a long-running debate means there are two sides to the issue. It just so happens I now am convinced by one side.

 

I belong to, and daily frequent, quite a few boards and blogs for professional web admins. I have been in the "so long as it validates, it is better than quirks mode and tag soup" camp for 2 years. But I found that the major players (those who right the books and have a seat on various w3c projects) have been hammering at us to change our thinking for the past 8 months or so. So I decided to stop being so stubborn and listen to what they were saying with an open mind.

 

I'm not following this mime serving thing. Do you declare the mime type in the document, much like the doctype?

 

No. The mime type is set in your server's configuration files. If you don't have server access (and are not admin authorized) to modify your server config file, then most likely it is set to serve xhtml as text/html by default.

 

Again, at the moment, this is all a matter of choice, and perception of what is truely "Valid". So don't panic. What got me, though, was why use xhtml trans, when, with a few tweaks here and there, you can just as easily use HTML strict?

 

For me, it would also not be much work to migrate xhtml to html

 

I started at the beginning of the week. You're right, it isn't really that hard. I can keep my lowercase tags and just remove the closing forward slash for the xhtml single closing tags. There were a few surprises, but they were minor (like not using "language=" in script headers).

Link to comment
Share on other sites

If you get past the idea of XHTML and HTML is just comes down to structure.  I prefer XHTML because it has a strong syntax.  I think using also XHTML makes web developers feel like we have a fresh start.  The 90's were full of weird implementations of web technologies, and today, it feels more like we have a firm base on the web.

Link to comment
Share on other sites

It strike me that the issues surrounding these technologies are more to do wth how they are implemented rather than the technology themselves.

 

I find it frustrating that browsers DON'T fail when someone uses erroneous markup with a doctype - I hated the fact that you coulld use xhtml 1.0 strict or 1.1 and have font tags in teh markup that worked and even target="_blank".

 

The biggest benefit for me is IE6 being much more compliant - reducing the amout of work I need to do to produce an ie6 style sheet for conditional include.  Bottom line is that as a professional developer you shoudl use a good DTD and validate it. This provides you with an excellent benchmark for debugging AND ensures your site is futureproof.

Link to comment
Share on other sites

I don't miss target="_blank" one iota!

 

its nothing to stick that in a bit of javascript so that those users who have it available get the 'enhanced user experience' while those without or not left with windows or tabs all over the shop whith no real representation of how to get back.

Link to comment
Share on other sites

Well I was going to argue with you, but I'm actualy finding myself agreeing with what you posted dang it.

 

LOL! I know, doesn't that suck?!! That's what happened to me.

 

while those without or not left with windows or tabs all over the shop whith no real representation of how to get back.

 

The whole point was to ONLY use it on those links that take you away from the site, so they could just kill the window to return. Remember the OLD rule of website Navigation Design (from back in the 90s)? "Never leave your visitors with nothing but a browser back button".

Link to comment
Share on other sites

I'd just spent a lot of time getting my sites validating as xhtml strict to you and I see you posting this, thats why I said dang it lol.

 

now I find out if I actualy change the mime type a lot of browser will have problems, and if I dont sheesh.

 

I'm thinking of just going back to good ol html, besides there's been some silly stuff with xhtml planned that will make things difficult anyhow

Link to comment
Share on other sites

"Never leave your visitors with nothing but a browser back button".

I still believe that myself, there are a lot of users around that don't know a lot, and well who don't want o know, and however much we would prefer not to, we have to bunny cuddle those people still.

 

Swell, just in time for the new HTML 5.0 and all the debate starting up about THAT!!!

Yah, and there will be a lot of debate, hell there already is

Link to comment
Share on other sites

Well I was going to argue with you, but I'm actualy finding myself agreeing with what you posted dang it.

 

LOL! I know, doesn't that suck?!! That's what happened to me.

 

while those without or not left with windows or tabs all over the shop whith no real representation of how to get back.

 

The whole point was to ONLY use it on those links that take you away from the site, so they could just kill the window to return. Remember the OLD rule of website Navigation Design (from back in the 90s)? "Never leave your visitors with nothing but a browser back button".

 

OLD rule being the definitive word.

 

In the new age of the web and accessibility users with visual or motor disabilities have issue with tracking where they are.  it is simple to recognize that you are not on the same site as before - even if using a screen reader.  Fact is the back button is used A LOT and people are used to what it does.  Those who don't have the tools (by that I mean eyesight good enough to see a new window opening, or any other impairment for that matter) DO use the back button when they get lost.

 

until fairly recently I still worked really hard to prevent page scrolling on home pages - but studies show that the vast majority of web users do - and are comfortable with - scrolling for content.

 

There are OLD rules of thumb that have been disproved.  Fact is the new window and how it shoudl be implemented has already been addressed in the standards.  The standards are to promote a consistent approach to building GOOD sites so that all can use them.  That should be good enough reason for anyone to just bite the bullet - accept the policies - implement them - and allow the world to enjoy a consistent behaviour over the web...

 

Just becasue and individual likes doing something a certian way does not mean its the best way to do it.  Great minds got together to come up with these guidlines to benefit the majority and provide a good platform to move on from.  Lets not make that effort a waste of time and ruin it for the majority eh?

Link to comment
Share on other sites

As usual, good points, TM. Yeah, accessibility ... it IS as important as standards, and as soon as my main site is converted I need to make it 100% accessible.

 

And, like I said, I "miss" target=_blank, but realize that valid code is much more important.

 

Just becasue and individual likes doing something a certian way does not mean its the best way to do it.  Great minds got together to come up with these guidlines to benefit the majority and provide a good platform to move on from.  Lets not make that effort a waste of time and ruin it for the majority eh?

 

That says it all in a nutshell. Even though we may sometimes disagree with the standards rules, we should defer to them; better minds than ours worried over them long and hard enough.

 

Which, LOL, brings me back to the xhtml/html debate.

 

Once one concedes that xhtml was initially conceived to be served as application/xhtml+xml and only "permitted" to be served as text/html (consequently when served as text/html really only makes it actually HTML with strange some strange tags), then one has to accept that the HTML Strict doctype is the ONLY valid standard for serving text/html web pages.

 

Using transitional doctypes for ANY new web page is lazy and wrong. It means you are NOT coding to the actual valid version of the code right out of the gate. It means are starting your page/site actually using old, deprecated, no longer valid tags, previously permitted but no longer proper syntax and basically a mishmash of previous versions.

 

Transitional doctypes are totally abused and not being implemented as intended. They were NEVER intended as an initial page doctype; they were intended for the poor suckers like me, who have thousands of pages of a LIVE website to revise that could take up to a year to complete. By using transitional doctypes, I was able to convert my quirks mode pages quickly and serve a transitionally valid website within a month or two, while working on the true revisions of the pages.

 

I'm thinking of just going back to good ol html, besides there's been some silly stuff with xhtml planned that will make things difficult anyhow

 

prime, converting your valid xhtml pages to html strict is much easier than you may think due to the "optional" nature of html 4.01 ... upper/lowercase tags or closing/not closing block level tags are equally valid. So the main things I had to change were simply single closing tags - like img, br or meta and remove "language" from my script tags.

 

I was able to convert all of my xhtml to html strict within a few days.

 

Dave

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.