XHTML vs HTML

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

XHTML vs HTML

Post by JellyFish »

What's the major difference between the two, other then a stricter document? I've been searching on what XHTML does that HTML doesn't. Is it like XML where you can create your own tags, with it's own name and attributes?
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

There are others who are better equipped to answer this, but...

XHTML doesn't support custom tags, NO! If you use one you'll get a validation error.

XHTML as far as I know requires some standards in writing HTML, such as:

1) quotes around attributes
2) smaller-case tag names
3) Tags are all properly closed

There is litter difference between the two except for the enforcement of standards - which are rarely a bad thing in software development.

I suppose there is also the cultural connection. XHTML is more often associated with accessible web pages, using CSS for layout instead of TABLE, etc...

Other than standards, there is little technical advantage...

Cheers :)
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

XHTML standardised documents should be parsable by xml tools, thus making xhtml an extension or application of xml.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

xhtml can be extended to validate with custom tags, but you have to build your own DTD. Not that a rendering engine would know what to do with them, mind you. It just renders as an inline element (a span, essentially).

I've used a custom DTD to extend xhtml for custom tag attributes I was using for a javascript form validation class. It wasn't actually necessary, I just felt like having valid xhtml. Would I bother doing it again? Ummmm.... meh.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

Kieran Huggins wrote:xhtml can be extended to validate with custom tags, but you have to build your own DTD. Not that a rendering engine would know what to do with them, mind you. It just renders as an inline element (a span, essentially).
Good point. I never thought of that.
Kieran Huggins wrote: I've used a custom DTD to extend xhtml for custom tag attributes I was using for a javascript form validation class. It wasn't actually necessary, I just felt like having valid xhtml. Would I bother doing it again? Ummmm.... meh.
Brilliant...I had a form validation class before as well...it worked so nicely but required adding custom attributes to each form element which broke XHTML validation...I never even thought of using custom DTD...

Thanks for the idea :)
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Post by JellyFish »

what about custom attributes to a valid element(div)?
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

Sure, why not? That's what I did.
Post Reply