Click to See Complete Forum and Search --> : [RESOLVED] Do you use XHTML or HTML 4.01 - why ?
jeddik
01-17-2007, 08:13 AM
Which standard do you use and why ?
I read this statement today:
"Personally, I use XHTML for every type of website now because it’s cleaner and more precise that HTML 4.01. "
This worried me because a couple of weeks ago I converted my doctype from this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
(which is the default for HTML-kit s/w)
to this :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
because I read somewhere it was "better" to use the strict version ??
Of course this entailed changing all the <br /> to <br> etc etc. :mad:
Now I am confused :o
Should I be using XHTML or what ?
Which standard do you use and why ?
This thread may help many to decide what to do.
Charles
01-17-2007, 08:17 AM
This gets discussed regularly. XHTML has some neat features but it is not compatable with HTML browsers. You can make it so by avoiding those neat features but then What's the point? Stick with HTML for web pages aimed at the general public.
Regarding strict vs. transitional, stick with strict.
For more details use this forum's search feature.
jeddik
01-17-2007, 08:24 AM
Thanks
The quotation is from "CSS: Cascading Style Sheets Made Easy" by Taylor Anderson which is part of the CSS references on this website.
So one "guru" says strict HTML and one says XHTML.
If the XHTML public pages wont be read properly by browsers ( you mean IE Opera and Moz FF I guess ), then why would CSS guru suggest doing all pages in it ?:o
Charles
01-17-2007, 08:32 AM
Why would you take HTML advice from a CSS "guru"? A lot of people who publish books are simply wrong. Search the forums for details
jeddik
01-17-2007, 09:25 AM
I did a search on XHTML but it came up with too many unrealated threads.
What do you suggest that I search for
- OR
can you remember any threads that really thrash this subject out ?
Thanks
duke_okc
01-17-2007, 09:29 AM
Try the link below. It has some info that might help.
http://www.w3schools.com/xhtml/
jeddik
01-17-2007, 09:33 AM
Thanks I will check out that.
I just restricted my search to "titles" and am now getting better search results.
Still what do YOU use XHTML or HTML ?
I think thats still a valid question isn't it ?
Charles
01-17-2007, 10:23 AM
I think that I answered it. When I need XHTML's special features I use XHTML. For things published on the web I use HTML 4.01 Strict.
Charles
01-17-2007, 10:24 AM
Try the link below. It has some info that might help.
http://www.w3schools.com/xhtml/The W3Schools has a lot of really bad information regarding XHTML. Use instead the W3C (http://www.w3.org/).
drhowarddrfine
01-17-2007, 10:44 AM
Just dittoing what Charles is saying. Chances are, in your case, use html4.01.
Stephen Philbin
01-17-2007, 11:01 AM
The discussions on this subject that really get to the point of why I and some others on the forum use one rather than the other can get a little in depth. I have no idea how much experience you have in web development, so forgive me if this sounds a bit condescending, but it's easy for people new to this sort of stuff to miss the point of the argument.
I'll try to give a simple breakdown of the situation:
When your web browser requests a page from a web server, the web server also tells the browser what type of file is being given. Usually, the type stated is text/html. The important thing to remember here is that the file extension has nothing to do with the type of file it is. As far as the http (the protocol used to send documents over the web) is concerned, a file called moose.html should be no more or less likely to be of the type text/html, than a file called moose.juice. A web browser should try to deal with a file based on what type of file the server has stated it to be.
XHTML should be sent as "application/xhtml+xml" and not "text/html". It can be (and more often than not, is) sent as text/html, but then doing so means there was absolutely no point what so ever in making your page with XHTML in the first place. In this case, you're essentially just giving the browser what it would regard to be as poorly written HTML. So if you're doing that, you might as well just give it good ol' HTML 4.01 strict and at least give it a clean and proper version of what you say you're giving to the browser.
"So why not send XHTML as 'application/xhtml+xml' then?" I hear you think. Well it's back to the first point. The plenty of systems out there that think they know better than all these pointless specifications that frighteningly clever people waste years of their time developing. They've got it all figured out and don't need to play by the same rules as everyone else. They don't need to be told what the type of file is. They can just tell by using the ridiculous method of looking at the last few characters of the file name. Or so they think. You send something as "application/xhtml+xml" with any extension other than ".xml", and you're going nowhere.
"Why .xml?" Because that's what XHTML is: an application of XML. And therein lies both the beauty of it, and it's biggest problem with working on the web. The main point of using XHTML is that you can extend it and combine it with other languages that you or someone else has created from XML. You can't do that though, if your web server is still stating that the file is text/html so that it works with more systems. Think back and ask yourself if you can recall ever seeing a site that used and extended XHTML beyond being a mere reflection of HTML. I would be amazed if you could.
There is actually another use of XHTML though that's much more likely to be seen on the web. Because the rules about the syntax of XHTML are very strict and dictate that a document must be "well formed", it makes it much simpler for programs to process such documents. Though again, a lot of the time, the file would need to be stated as being of the correct type, otherwise it may be ignored or unusable. So if you intend a document to be used by both people and machines, you're back in the same boat.
So basically, the moral of the story is that there just isn't a great deal of point in using just XHTML. Especially among those who became web developers the instant they finished illegally downloading Dreamweaver, it tends to get used largely because it's got an X in the name and it sounds good when you're trying to blind prospective clients with science.
As for the question of which do I use? Well I use a combination of the three (or at least I do when my site is switched on). Everything on the server side is XML, then it gets spat out at the user as either HTML or XHTML (or something else entirely) depending on the outcome of some needlessly over complicated checks to see which the browser supports.
Charles
01-17-2007, 11:11 AM
XHTML should be sent as "application/xhtml+xml" and not "text/html". It's a wee bit more complicated than that. http://www.w3.org/TR/xhtml-media-types/
Stephen Philbin
01-17-2007, 01:04 PM
Yeah. I had that in mind when writing my last post out, but for the sake of keeping things a little clearer and more understandable for beginners, I thought it best to just skim over that one for now. Showing the reasoning behind the opinion was the important point. My server side stuff I mentioned as serving text/html, application/xhtml+xml and a few others: some of those others are the alternatives mentioned in http://www.w3.org/TR/xhtml-media-types/
drhowarddrfine
01-17-2007, 01:46 PM
I resent this remark:Especially among those who became web developers the instant they finished illegally downloading DreamweaverI did NOT download my illegal copy of Dreamweaver. In fact, I don't even use my illegal copy!
Good post, though. ;)
duke_okc
01-17-2007, 02:14 PM
Especially among those who became web developers the instant they finished illegally downloading Dreamweaver
I am bit offended too :) This post, as good as it might be, suggests that one can only be a web developer if he/she uses Dreamweaver and I have never used Dreamweaver before.
Stephen Philbin
01-17-2007, 06:53 PM
...suggests that one can only be a web developer if he/she uses Dreamweaver and I have never used Dreamweaver before...
You'll have to forgive my stupidity, but I'm unsure about whether or not that comment was make in sarcasm or not. I'm leaning more towards yes, that was sarcasm, but just in case it wasn't (and also for the benefit of those that started learning with Dreamweaver and are yet to get a feel for web development in a broader sense), I'll clarify my position:
There's absolutely nothing wrong with using Dreamweaver. The comment was more about individuals that assume that just because they have obtained a "professional" piece of web development kit, they laud themselves with the title of "Professional Web Developer". This is something to which I take exception. I've been learning for many years and I still do not consider myself to be at a level that I would consider to be accepibly professional. Perhaps I have an unusually harsh view of what is a professionally skilled developer. It's just those "I can draw pretty pictures in Dreamweaver so I'm a web developer" types that get on my ***s. -.-
Sorry for the rant.
tweakyg
01-17-2007, 09:32 PM
I too have been confused about whether to use XHTML rather than HTML. I've cruised the web and read heaps of articles on this, including the w3c info but I just get more confused. I did hear that pages created as XHTML download quicker due to the cleaner coding, but I have no idea if that is correct or not.
There are so many people out there with different opinions that when you are trying to make some sense of it, you've no idea who is knowledgable and who just thinks they are. :) So thank you Stephen Philbin for explaining things so clearly.
Thank you also to the person who posted the information about strict and transitional. (sorry forgotten your name at the moment).
jeddik
01-18-2007, 01:27 AM
Great post Stephen, thanks for going to the trouble of writing that good explanation. The only thing missing is:
So what extra facilities do you use in XML ( and therefore XHTML) that are not in HTML ?
Just a few examples would be nice because so far it has just been hinted at
eg by Charles."When I need XHTML's special features I use XHTML."
and by Stephen "Everything on the server side is XML,"
I am not a complete novice (just a normal novice :) )
Everything on my serverside is php - and spits out HTML I have never looked at XML.
So what are these "server side stuff" and "special features" ?
Thanks
Stephen Philbin
01-18-2007, 02:52 AM
Ah. Looks like I might have caused a bit of confusion here. It looks like I might have given the impression that XML does all of my server side processing. Best clear it up before continuing.
When I said "everything on the server side is XML", I didn't mean absolutely everything. I too use PHP. I was speaking merely in terms of markup. All of my server side markup is XML which is processed by PHP. My PHP stuff pulls data from the database and gathers together whichever XML and XHTML files it needs to create the desired page. Then it processes it all and sticks it all together and spits it out in the desired format. XML doesn't do any processing on the server side at all. It can't do. It's just a markup language.
Ok. So with that clarified and out of the way, on to your main question. There's a few reasons why you might want to use XHTML "properly" by sending it as application/xhtml+xml. Like I said before, it can significantly improve interoperability between applications on seperate hosts/domains, but the reason Charles tends to mean (or at least this is the impression I get) is to extend it.
The first thing to remember about XHTML is that it is a markup language which has been created from XML. You can also define many other markup languages with XML. When you have two (or more) languages that are made from XML, you can combine them for use in a single document.
I believe Charles has used XML to define a Calendar markup language that he has for personal use. Now if, for example, he wanted to use it on a web page, he could combine it with XHTML and use both languages in the one web document (so long as the user is viewing the document in a capable browser).
Have a look at this: http://www.w3.org/QA/2002/04/valid-dtd-list.html It's a list of DTDs for a few of what are probably the most commonly used markup languages defined in XML. As you can see, there's quite a few of them and some of them are combinations of others already on the list. That's basically what's meant by the extensibility of XHTML.
As for the "It downloads quicker" thing, that's just rubbish really. Just sounds like someone trying to think of any reason they can to justify the use of XHTML. There's certainly no shortage of people out there producing equally bloated tag-soup monstrosities in XHTML. If anything, XHTML served as text/html and written in accordance with the XHTML compatability guidelines would in all probability actually take longer to download because of the extra space and slash characters which the browser discards as bad syntax and would not be there to increase the file size if it were written in HTML!
jeddik
01-18-2007, 04:15 AM
I have just done a Google Search on "XHTML advantages"
Here is the first one I found:
"XHTML first came along in December of 2000. It has since then grown in popularity substantially but has yet made the final leap. Although XHTML has some problems being viewed in Internet Explorer, it is still of great use and is very powerful.
Unlike HTML, all XHTML have to have a closing tag. Be it an img or a p, it has to end. This is great practice for beginners and also helps even the most advanced markup writer keep up on his work. Also, if you are looking to impress your buddies or if you are looking to start your own web design business, XHTML is a good place to start. It makes your source code clean and readable, the most important things when looking for a professional.
Not only that, it has other benefits as well. With XML becoming ever so popular, XHTML comes right along with it.
XML has been gaining ground ever since the start of RSS and will only grow as the weeks and months go on. When Firefox announced the support of live bookmarks in 1.0 the frenzy just began.
Since the beginning of 2004, Yahoo, MSN and many other news organizations have came out with RSS support. Plus, with the rise of blogs XHTML and XML have come to the forefront of today's technology.
With Internet Explorer getting heat from Firefox with Opera (who also has RSS support) holding onto a small percentage, they are looking at possibly using RSS support to help hold down the Mozillians.
So in retrospect, XHTML shows professionalism and is the future of the World Wide Web. So why not stay ahead of the game and switch over now It is worth your time, believe me.
By Gary Hess
Published: 3/1/2005"
Well that one was a bit wishy-washy !
But here is a good one:
It starts off with quite an emphatic statement:
It's been more than four years since XHTML replaced HTML 4 as the standard markup for Web documents, according to the W3C, and yet most Web builders still haven't switched to XHTML. That's a puzzling observation considering that XHTML boasts several advantages over the older HTML standard, and you can implement the new standard with only modest changes to your code.
It then goes on to explain the advantages pretty well:
http://www.builderau.com.au/program/web/soa/Making_the_switch_to_XHTML/0,339024632,339129783,00.htm
Your thoughts - anyone ?
jeddik
01-18-2007, 04:51 AM
With regard to "speed advantage", I have noticed several times that people are saying :
An XML parser is definitely more lightweight than a full SGML parser, so valid, well-formed XHTML should render faster in a browser that takes advantage of this difference.
Also this point seemed valid:
In short: The XHTML DTD is better to work with, 'cause it is stricter than the HTML one.
It also seems to me that if you want to branch out and allow your website to be available on WAP or iPOD or RSS then writing in XHTML might be valuable.
This link gives quite a bit of info:
http://www.w3.org/MarkUp/2004/xhtml-faq#need
but it is 2.5 years old ?
Your opinions ?
Charles
01-18-2007, 07:35 AM
[quote]An XML parser is definitely more lightweight than a full SGML parser, so valid, well-formed XHTML should render faster in a browser that takes advantage of this difference. Quite wrong.In short: The XHTML DTD is better to work with, 'cause it is stricter than the HTML one. I am ever amazed at just how ignorant people are concerning XHTML.
XHTML is a whole lot more than lowercase element and attribute names, quoted attribute values and all elements closed. But those other things—external entities, XSLT style sheets, multiple namespaces—are completely incompatible with HTML and HTML browsers. So when person tries to explain XHTML to person two the good but troublesome parts get left out. Then person two tries to say that XHTML is simply a cleaned up version of HTML. What most people think of as XHTML is more like HTML++, but XHTML-- is closer to the truth. HTML/XHTML perhaps expresses it best.
Now, an argument could be made that HTML/XHTML is easier to parse than HTML but nobody is going to write browser for just HTML/XHTML. They’re going to write it for XHTML. And all those feature that you don’t understand take a great deal of overhead. An XHTML browser is going to run slower than an HTML one, but not so slow that a human will notice.
It's been more than four years since XHTML replaced HTML 4 as the standard markup for Web documents, according to the W3C, and yet most Web builders still haven't switched to XHTML. That's a puzzling observation considering that XHTML boasts several advantages over the older HTML standard, and you can implement the new standard with only modest changes to your code. I don’t know where people get this stuff. XHTML has not replaced HTML. HTML 4.01 is the gold standard, though HTML 3.2 is still valid.
And just to be clear, MSIE is the one and only browser out that gets XHTML correct. It’s just that you have to use a “.xml” filename extension. FF and Opera mungle it up.
.
Charles
01-18-2007, 07:40 AM
This link gives quite a bit of info:
http://www.w3.org/MarkUp/2004/xhtml-faq#needHow cute. He mentions that the namespace is required in XHTML but his example omits it. Ignore that article.
jeddik
01-18-2007, 08:47 AM
Well I am learning quite a bit about this :)
How cute. He mentions that the namespace is required in XHTML but his example omits it. Ignore that article.
Can you give an example of namespace code so that we know what it looks like ?
As you didn't knock my summary, does it mean that you agree with it ?
(even if it is only a tiny little bit :) )
It also seems to me that if you want to branch out and allow your website to be available on WAP or iPOD or RSS then writing in XHTML might be valuable.
Many thanks
XHTML has not replaced HTML. HTML 4.01 is the gold standard, though HTML 3.2 is still valid.
This is so true. The Web is built on the basis of HTML. It's far too late to change it now. That would be like saying all buildings in large cities have to get rid of their concrete. XHTML has its purposes but for basic structure of Web sites, HTML is still the standard for building the structural layer of the page as CSS is for building the presentation of the page.
Charles
01-18-2007, 09:35 AM
Can you give an example of namespace code so that we know what it looks like ?That would defeat my purpose. No one should even think about using XHTML, or asking any more questions about XHTML, until the following have been read and understood: http://www.w3.org/TR/html401/ , http://www.w3.org/TR/REC-xml/ and http://www.w3.org/TR/xhtml1/ . After lunch you can work on http://www.w3.org/TR/xslt and http://www.w3.org/TR/xhtml11/ . For kicks see http://www.w3.org/TR/xhtml2/ .
jeddik
01-18-2007, 11:54 AM
Well the idea of this thread is to cut through a days worth of reading of stuff that is 90 % already known and get to the bits that are not known. :)
Can anyone else give example of namespace code ?
Charles
01-18-2007, 12:49 PM
Well the idea of this thread is to cut through a days worth of reading of stuff that is 90 % already known and get to the bits that are not known. :)
Can anyone else give example of namespace code ?From your questions I would say that about 9% is known. And if you are too lazy to read the specs. then I'm certainly too lazy to type them over for you.
felgall
01-18-2007, 01:06 PM
Perhaps one reason why XHTML is thought by some to be faster loading than HTML is because all ending tags are mandatory while with HTML some are defined as "optional". Where the "optional" tags are omitted the browser is required to work out where they should be and add them in. If you always include the optional end tags in your HTML markup then your page wont be slowed in loading while the positions of the missing tags is worked out. Good coding practice for HTML is to include all of the end tags, quote all of your attributes etc. The specification says that they are optional in order to require browsers to handle when they are left out because there are so many people that don't know how to write their HTML properly. Perhaps part of the confusion as to whether HTML or XHTML is better is due to XHTML requiring good coding practices for all pages while with HTML you can either write good HTML or garbage and still have it display properly in web browsers (after the browser adds in everything you left out).
Charles
01-18-2007, 01:26 PM
Perhaps one reason why XHTML is thought by some to be faster loading than HTML is because all ending tags are mandatory while with HTML some are defined as "optional". Where the "optional" tags are omitted the browser is required to work out where they should be and add them in. If you always include the optional end tags in your HTML markup then your page wont be slowed in loading while the positions of the missing tags is worked out. Good coding practice for HTML is to include all of the end tags, quote all of your attributes etc. The specification says that they are optional in order to require browsers to handle when they are left out because there are so many people that don't know how to write their HTML properly. Perhaps part of the confusion as to whether HTML or XHTML is better is due to XHTML requiring good coding practices for all pages while with HTML you can either write good HTML or garbage and still have it display properly in web browsers (after the browser adds in everything you left out).In HTML certain tags are optional simply because the browser doesn't need them. Say the browswer is happily parsing some P element. As soon as it hits another block level element, something that the P element cannot contain, said P element is closed. There is no delay.
jeddik
01-18-2007, 02:37 PM
Good post Felgall.
I am thinking that if I try and modify and improve my coding so that :
1) all my tags are lowercase ( so I wouldn't have P element only a p )
2) close my tags
3) quote all of my attributes ( is that double quotes only ? )
4) always have Html, head, body, and title elements
5) always nest elements properly
then my code will be better and easy to migrate to XHTML if I need to or to put it better - I will have the good habbits necassary to code it XHTML.
Of course for XHTML the Namespace designation is required: <html > :cool:
Also the /> needs to be used - but that can be done with find/replace if or when necessary as I dont want to mess up my HTML 4.01
I have found the postings in the XML forum useful to browse through - I can see what its being used for. :)
Any further thoughts ?
Charles
01-18-2007, 02:53 PM
Any further thoughts ?Just stick with HTML 4.01 Strict and Validate (http://validator.w3.org). Don't worry about XHTML. If for some strange reason you need to convert then use HTML Tidy (http://tidy.sourceforge.net/) or any nunber of other tools that will do it for you in a snap.
felgall
01-18-2007, 03:16 PM
If you view the source of the web page after the browser has parsed it you wwill find that all of the missing tags have been added by the browser. It may not take the browser very long to add the tags but it does take some time for it to do so. The difference in processing time may be insignificant but it is not possible for code to run in zero time.
In any case it is still better coding practice to include the end tags in your code since then you can see exactly where they are rather than leaving the browser to insert them and so if you intended for them to be somewhere other than the spot the browser will put it then it will be easier to locate your error.
The W3C standards outline the rules that the web browsers need to follow to be able to correctly interpret web pages. The standards that people writing web pages should follow involve a number of other factors as well and while everything that is mandatory in the browser is also mandatory for writing web pages there are a lot of optional things in the W3C standards that should be mandatory in any decent standards that are being followed in producing web pages. The W3C web standards make up at most 50% of the standards that any web page author should be following iif they expect to write easy to maintain web pages.
jeddik
01-19-2007, 03:12 AM
That interesting !
When you say :
If you view the source of the web page after the browser has parsed it you wwill find that all of the missing tags have been added by the browser.
Do you mean by using the "view - source" (in IE) "view - pagesource" (in FF) ? Or are you meaning another technique. ?
If you mean the view souce then I must say that I hadn't noticed any closing of <p> s etc.
SECOND POINT:
I couldn't help looking at the page source of this forum as I am writing this post !
I saw these two sets of code in this page:
Have a look at this: <a href="http://www.w3.org/QA/2002/04/valid-dtd-list.html" target="_blank">http://www.w3.org/QA/2002/04/valid-dtd-list.html</a> It's a list of DTDs for a few of what are probably the most commonly used markup languages defined in XML. As you can see, there's quite a few of them and some of them are combinations of others already on the list. That's basically what's meant by the extensibility of XHTML. <br />
Notice its all lowercase and the <br /> at the end.
Then later we find this type:
<A HREF="http://www.webdeveloper.com/RealMedia/ads/click_lx.ads/intm/webdev/www.webdeveloper.com/forums/1840937782/accessunit/OasDefault/Devx_IBMSkillBuildingPortal_2i/Revised_IBM_SB_AU1.html/35353630316339663434333432356130?
ibm/Link/32078" style="color:#0033FF"><B>Tester Kit: Improve Test Efficiency and Accuracy
</B></A><BR>
Here we have just the <BR> no "/" and not in lowercase
So looks like the page is half HTML and half XHTML
I guess thats what the transitional means in the doctype ?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" lang="en"> ?
Any comment on these two points ?
felgall
01-19-2007, 04:19 AM
To view the source of the page the way the browser sees it you need to either be using Netscape 7.0 and save the page (for some reason that version only saves the parsed page rather than the source) or use a javascript view source bookmarklet or user script to grab the content of the page and convert all of the & < and > into the equivalent entity codes so as to view the parsed version of the page as it is currently after any Javascript updates.
Just using view source will show you the original source that the browser reads and not what the browser has done to modify it to comply with its rules on how the page is required to be coded - which usually involves converting the case of all the tags that it considers to be in the wrong case, adding or removing quotes around attributes and inserting all the missing tags.
jeddik
01-19-2007, 04:29 AM
Thanks - I was thinking that must be the case otherwise "source" would have been a completely wrong description! It would have needed to be "browser modifıed source" - which would NOT have fitted into the menu :D
What about the second point ? How come the mixed up std' of code for this forum ?
Stephen Philbin
01-19-2007, 04:50 AM
The mixed markup is most likely just a symptom of large scale Corporate webmastering. The software for this forum is not written by any staff of the JupiterMedia Corporation. It's written by an entirely seperate group of people. The corporation uses this generic forum software on many many sites and as far as I know, Joe or some other member of staff may get a chunk of code handed to them for adding as a hack to the forum software and many other places and pages. It might end up in a page that's all 4.01, or it might end up somewhere like this forum that uses XHTML.
It's also very common for code to be used which is completely out of the control of anyone here and is defined by whichever advertising source it comes from. We've had trouble from things like strangely coded adverts in the past, but there's not really anything anyone can do about it.
jeddik
01-19-2007, 05:04 AM
Thanks for all the good advice and input.
I was also hoping to find out what people are using XHTML for - that was the "why" part of me initial question. But maybe I should start a new thread for that one.
Charles
01-19-2007, 06:50 AM
It's also very common for code to be used which is completely out of the control of anyone here and is defined by whichever advertising source it comes from. We've had trouble from things like strangely coded adverts in the past, but there's not really anything anyone can do about it.Another example of why one ought to avoid XHTML.
Charles
01-19-2007, 07:15 AM
Thanks for all the good advice and input.
I was also hoping to find out what people are using XHTML for - that was the "why" part of me initial question. But maybe I should start a new thread for that one.I think that most people use XHTML because they think it makes them look cool. To the contrary then end up less popular with the ladies.
The whole point of XHTML was to permit one to easily mix it with other languages. You can do this with HTML too, in theory, but it gets a little messy.
Because of HTML's optional tags you can't do any error checking at all without a DTD. The DTD sets down what elements can contain what other elements. We can omit the closing tag for a P element because the browser knows that P elements cannot contain other block level elements. But if we merge HTML with MathML the browser doesn't know what the MathML block level elements are without a DTD. Writing DTDs is a little annoying. By omitting optional tags and elements without closing tags we can now check for "well formedness" of any XML based mark up language.
But then What happens if both languages have a TITLE element and each allows different attrubutes and child elements? Enter the namespace. In XHTML there is no TITLE element, it's a http://www.w3.org/1999/xhtml:xhtml element - xhtml:title for short.
That said and has been noted above by an overly observant and kind soul, I've been known to use XHTML as the base for my own mark up languages to better organize my data. Mathematicians have at their use XHTML + MathHL. But these are, however and intentionally so, suitable only for a limited audience that has the tools to make sense of the new ML.
More commonly I use XHTML because some nifty tools exist for manipulating it. XSLT and XSL-FO are two syntaxes that allow me to keep my content in one page and the redundant headers and footers collected somewhere else and easily edited. And I can quickly genereate HTML or PDF versions of things. I quite often use XSL-FO to generate PDF documents. XSLT and XSL-FO make one quite popular with the ladies.
Charles
01-19-2007, 07:21 AM
If you view the source of the web page after the browser has parsed it you wwill find that all of the missing tags have been added by the browser. It may not take the browser very long to add the tags but it does take some time for it to do so. The difference in processing time may be insignificant but it is not possible for code to run in zero time.
In any case it is still better coding practice to include the end tags in your code since then you can see exactly where they are rather than leaving the browser to insert them and so if you intended for them to be somewhere other than the spot the browser will put it then it will be easier to locate your error.
The W3C standards outline the rules that the web browsers need to follow to be able to correctly interpret web pages. The standards that people writing web pages should follow involve a number of other factors as well and while everything that is mandatory in the browser is also mandatory for writing web pages there are a lot of optional things in the W3C standards that should be mandatory in any decent standards that are being followed in producing web pages. The W3C web standards make up at most 50% of the standards that any web page author should be following iif they expect to write easy to maintain web pages.Omitting optional elements doesn't slow down parsing in any meaningful way and may even speed it up. There's less to parse. What slows things down, a lot, is keeping a eye out for omitted tags. As long as you are parsing HTML, or XHTML as HTML, you have that considerable overhead no matter what you omit or not.
And as I wrote above, don't think that you will gain any speed by switching to XHTML. The other features of XHTML, and the keeping an eye out for them, slow things down even more.
Stephen Philbin
01-19-2007, 08:12 AM
My use of XHTML is a vaguely similair one. I have generic markup fragments that crop up in just about every XHTML document I make, so I can pretty much just develop the content and then pull in all the other bits and bobs to form a complete document.
Then like I said earlier, it all just gets spat out at the user in (as close as possible to) the most suitable format. Anyone that can view XHTML (excluding Konqueror users) get the XHTML, but more cpu time is taken to use XSLT to transform the XHTML document into HTML for everyone else. That way, I get to make documents in a much easier and convenient way and I don't really need to fuss about what format it comes out as.
That and easy to transport data are my main uses of it.
jeddik
01-19-2007, 11:54 AM
These last few posts have been very informative :)
(BTW I did start a new thread but it seems to have been deleted :eek:
so , in that case ... can this thread have the RESOLVED removed so that others will not be put off from adding their toupence worth ? )
thanks :)
felgall
01-19-2007, 02:33 PM
Omitting optional elements doesn't slow down parsing in any meaningful way and may even speed it up. There's less to parse. What slows things down, a lot, is keeping a eye out for omitted tags. As long as you are parsing HTML, or XHTML as HTML, you have that considerable overhead no matter what you omit or not.
And of course there is also the huge amount of extra time that can be taken up in trying to figure out why your page doesn't look the way you expected because the browser inserted the omitted tag in a spot different from where you expected it to be whereas if you were required to put it in to start with you would soon spot the problem when you validate the page and it complains about your having put the tag in the wrong place.
jeddik
01-20-2007, 03:17 PM
Hang on a minute - we finished that bit !
We are now talking about whats useful about XHTML.
What do you use it for and how - come on there must be more that two using it :)
the tree
01-21-2007, 05:12 AM
When I get round to it, I'm going to convert my website to XHTML so that I can easily integrate MathML and SVG (thinking of having all H2s styled as SVG text, not sure how yet). Since only complete nerds are likely to even glance upon my site, browser compatibility isn't a huge problem.
Apart from the mixing and matching of technologies, there really isn't much other reason to use it.
Stephen Philbin
01-21-2007, 08:55 AM
Apart from the mixing and matching of technologies, there really isn't much other reason to use it.
Nail Head, I'd like you to meet High Velocity Impact.
jeddik
01-21-2007, 08:55 AM
So you are going to integrate MathML and SVG. Sounds great ! but ...
...
What will you use the MathML and SVG for actually doing ?
How will you benifit from doing that ?
Thanks for any more insights :)
Stephen Philbin
01-21-2007, 09:16 AM
Presumably he'll use MathML to mark up mathematical notations and SVG to place scaleable vector graphics of varying types and sorts on the page without screwing up the rest of the document.
ercatli
01-24-2007, 01:52 AM
I wonder if anyone will mind if I re-open, even if briefly, some of the discussion on this thread. I have read it all, understood much of it, but still feel a little uneasy. There are many opinions "out there" on the web, some of them different to what is given here. I think I can accept the predominant advice here, which is, because I am a novice, using HTML 4 is the best doctype for me. But I would like to clarify facts behind this advice, just so I understand better.
This is particularly so because I did a quick check of 20+ sites I visit a lot, and found that they were roughly evenly spread among HTML 4, XHTML 1.0 transitional and XHTML 1.0 strict. I found none with XHTML 1.1 in this small sample. So the majority seem to have gone to XHTML.
So I wonder if someone could confirm please that these would be generally accepted facts, on which the various opinions are based:
1. Some (most?) browsers can't yet handle XHTML properly.
2. XHTML is only really useful if you have a specific reason and you know you need it.
3. HTML 4 (5 is coming?) will be around for at least a decade and is not inferior for general use.
4. If XHTML is the way of the future, that future is likely to come very slowly.
Any comments would be gratefully received, thanks.
Charles
01-24-2007, 07:23 AM
Let me just say "external entities". So far only MSIE gets them right. For more on that, and what "external entities" are, and the rest of your questions see the links that I posted in Post #26 above.
nitrexoxide
01-24-2007, 09:59 PM
I have read in several places that the web is moving on from HTML to XHTML (like from 4.x from 3.x i presume). In a previous alanalogy someone said "it would be like making all buildings in a city block ditck concrete". How I see it (from the view of the articles I have read) is rather that force ditching of concrete, new building can use new, better materials and technologies. And also, I have out of intrest tried coding a page in XHTML and found no difference between FF & IE. (No hacks even). So, basically what you are saying is HTML 4 is better that XHTML and always will?
Charles
01-25-2007, 05:11 AM
So, basically what you are saying is HTML 4 is better that XHTML and always will?No one wrote that. Please read this thread more carefully.