IS there any reason to actually write XHTML over HTML?

notfred

Lifer
Feb 12, 2001
38,241
4
0
Assume for the moment that you're not using XML tools to generate or read your HTML document. Is there any other reason at all to use XHTML? I mean, I don't think very many people need webpages to be XML for any reason.
 

Red Squirrel

No Lifer
May 24, 2003
70,742
13,855
126
www.anyf.ca
I don't see the point either. I hardly know xml and it's for that reason - I only use html (and loads of php and css) and it does the job. Actually, I'm getting more and more hooked on using php for "repeat" tasks such as lists, so instead of updating a html file I just make it read a file that generates the rest. php is probably a must for a complex or even simple site that has to be updated time to time. No special viewer needed, you just need a server that has it.
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Basically, the only big differences in xhtml that you have to deal with as a writer-of-html are:

1. Elements and attributes must be lowercase. <B> is invalid, <b ALIGN="right"> is invalid, <b align="right"> is ok. <b class="FooBar"> is ok too.

2. Attribute values must be quoted, like they are in #1.

3. Elements with no closing tag need to end with " />". <img src="foo"> becomes <img src="foo" />.

That's essentially it.
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
Originally posted by: BingBongWongFooey
Basically, the only big differences in xhtml that you have to deal with as a writer-of-html are:

1. Elements and attributes must be lowercase. <B> is invalid, <b ALIGN="right"> is invalid, <b align="right"> is ok. <b class="FooBar"> is ok too.

2. Attribute values must be quoted, like they are in #1.

3. Elements with no closing tag need to end with " />". <img src="foo"> becomes <img src="foo" />.

That's essentially it.

I know you know this, I'm just pointing it out for others...

And perhaps the most important, you must close all tags. No more open-ended tags to cause problems. i.e. "<p>Test" is invalid, but "<p>Test</p>" is valid. Of course, all of the attributes of well-formedness in XHTML are inherent in XML, not something added to XHTML.

 

Superwormy

Golden Member
Feb 7, 2001
1,637
0
0
Someday, when all browsers are strickly XML based ( hehe as if this will ever happen ) HTML pages won't work, only X/HTML complaint ones will.

But really, X/HTML is a lot cleaner than HTML anyway, a lot more standard. Be nice to the next guy that has to edit your code and use X/HTML.
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Originally posted by: Superwormy
But really, X/HTML is a lot cleaner than HTML anyway, a lot more standard. Be nice to the next guy that has to edit your code and use X/HTML.

It's only cleaner if you <TYPE HTML=LIKETHIS>. My html looks just the same as any xhtml, except it doesn't have <these />.
 

dukdukgoos

Golden Member
Dec 1, 1999
1,319
0
76
If you set up your MIME types to serve XHTML as an XML application, you'll trigger the XML parser rather then the HTML parser in modern browsers. This will improve rendering performance, as the XML parsers are much more efficient than the bloated HTML parsers with all the extra code to handle error-ridden HTML.

Admittedly, because IE doesn't understand the correct MIME type, almost nobody is actually doing this.
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Originally posted by: dukdukgoos
If you set up your MIME types to serve XHTML as an XML application, you'll trigger the XML parser rather then the HTML parser in modern browsers. This will improve rendering performance, as the XML parsers are much more efficient than the bloated HTML parsers with all the extra code to handle error-ridden HTML.

Admittedly, because IE doesn't understand the correct MIME type, almost nobody is actually doing this.

Seems like pretty much all web technologies are sabotoged by IE one way or another. Microsoft, what an "innovator."
rolleye.gif
 

Firus

Senior member
Nov 16, 2001
525
0
0
I think one of the big things the W3C is trying to push with XHTML is the standardization issue, the thing is, it would be really hard to get everyone to do it how they want it done, when there is no real benefit of doing it that way (xhtml compliant). There is one advantage to using xhtml...you can go validate it and you get to link to the little W3C gif saying that your site is compliant :D
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
Originally posted by: Firus
I think one of the big things the W3C is trying to push with XHTML is the standardization issue, the thing is, it would be really hard to get everyone to do it how they want it done, when there is no real benefit of doing it that way (xhtml compliant). There is one advantage to using xhtml...you can go validate it and you get to link to the little W3C gif saying that your site is compliant :D

You can do the exact same thing with HTML 4.01.
 

dukdukgoos

Golden Member
Dec 1, 1999
1,319
0
76
Originally posted by: notfred
Originally posted by: Firus
I think one of the big things the W3C is trying to push with XHTML is the standardization issue, the thing is, it would be really hard to get everyone to do it how they want it done, when there is no real benefit of doing it that way (xhtml compliant). There is one advantage to using xhtml...you can go validate it and you get to link to the little W3C gif saying that your site is compliant :D

You can do the exact same thing with HTML 4.01.
Yep, the important thing is that you choose a standard and validate to it. You can even write HTML 3.2 and if it's perfectly valid, the W3C's purpose is being served.

FYI, here's an article about serving XHTML with the proper MIME type.
 

Buddha Bart

Diamond Member
Oct 11, 1999
3,064
0
0
HTML 3.2 was created as a very very meager attempt to get the browser vendors to standardize (and there are no innocent parties in that fight). It wasn't even so much a "lets agree to this" as a "lets document almost every hack out there".

HTML 4.0(1) was an attempt to standardize the language much more, and move presentational things into CSS. However since everyone on god's green earth used the "transitional" doctype instead of the "strict" it is barely any different than 3.2.

XHTML is the W3C's first real attempt to stop just making a middle-ground agreement, and genuinley think things through on what makes the most sense, whats the most consistant, whats the most parseable, etc

So basically using anything pre-xhtml 1.0 is really just being an 'enabler' to the whole fast-and-loose attitude browser makers have had with standards. Some will bring up the whole "oh well the older ones are standards too" but as I explaned above those were more compromise than computer science.

I'm not a complete wacko about it though, there are some legitimate not-alientating-even-4% business reasons for not having a page that validates completely. Actually its pretty easy to validate, whats hard is not using table-based layouts.

ignorance, laziness, and an "i'm to cool for this xml buzzword stuff" attitude are the only reason's i've ever seen anyone not adopt an xhtml preference.
 

ProviaFan

Lifer
Mar 17, 2001
14,993
1
0
Originally posted by: Buddha Bart
Actually its pretty easy to validate, whats hard is not using table-based layouts.
Though not using table based layouts is a recommendation if possible, I didn't know it was required yet. The W3C accessibility spec recommends CSS for layout, but permits tables if used properly (at least it did when I read it a month ago).
 

Czar

Lifer
Oct 9, 1999
28,510
0
0
xhtml is a standard, while html is more of a guideline :p

I see no reason not to at least
 

Buddha Bart

Diamond Member
Oct 11, 1999
3,064
0
0
jliechty: You're right, its not requred yet. I'm really looking forward to the day the box-model is sorted out between browsers, holy crap its such a nicer way to code and design. In the mean time I stick to an extremely spartan table-based design. Usualy with only your basic header td (colspan="2") left nav td, and content td.