Page 1 of 1
XHTML vs HTML
Posted: Tue Oct 30, 2007 6:22 pm
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?
Posted: Tue Oct 30, 2007 8:41 pm
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

Posted: Tue Oct 30, 2007 9:40 pm
by s.dot
XHTML standardised documents should be parsable by xml tools, thus making xhtml an extension or application of xml.
Posted: Tue Oct 30, 2007 11:38 pm
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.
Posted: Wed Oct 31, 2007 1:04 am
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

Posted: Wed Oct 31, 2007 5:15 pm
by JellyFish
what about custom attributes to a valid element(div)?
Posted: Wed Oct 31, 2007 7:51 pm
by Kieran Huggins
Sure, why not? That's what I did.