Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

html 4.01 or xhtml 1.0 which doctype should I use.

Status
Not open for further replies.

newcow

Technical User
Feb 24, 2004
80
0
0
CA
Hi,
I have been wondering what to do with my site . Where I should leave it html 4.01 stict or change the doctype to xhtml 1.0 strict.

I have converted my site and put all the symantics or presentation markup in a CSS file. I have gone from html 4.01 trans to stict. And now I am wondering about going to xhtml 1.0 strict.

There to be wasn't alot of different between the way I was doing my pages in html 4.01 stict and xhtml 1.0 stict. All my tag names were already in lowercase, my documents were "well-formed", all the elements were properly nested. The only thing I ready had to do was change my elements that weren't close to closed <br> vs <br />.

So it will be pretty simple to move over. In fact I when ahead and moved over. It was a good experience. It took me about 1/2 a day to convert 3 sites.

I have a few questions. Should I move over? Do I need to move over? Is there any problems with me having moved over?

Also I would like to know about the the following line.
<html xmlns=" xml:lang="en">. Should I put this line in? What does it do? Will it cause problems?

I enjoyed very much moving my site from markup done by tables to putting all presentation in my CSS file. I want to be in the know on the way the internet is going for pages and do what is right. Any URLs, suggestions or tips will be received with thanksgiving!

newcow
 
Is there a question here? I can see that your page is XHTML 1.0 Strict valid, so claims the w3 validator. So I guess you have moved. If you noticed any problems with the site since you migrated to XHTML 1.0 than you should look into what the problems are and if you can get rid of them. But if it is nothing, just be glad that you have a site which conforms to the most rigid standard today and is ready for the future.
 
Hi Vragabond;

Yes I went ahead and changed the doctype and validated. No problems with the site at all.

My questions were as follows:
1) Also I would like to know about the the following line.
<html xmlns=" xml:lang="en">. Should I put this line in? What does it do?
2) Do I need to move over? [from html 4.01 stict to xhtml 1.0 strict] Is there any problems with me having moved over?

newcow
 
Most of web sites serve for viewing, printing and eventually forwarding (Save as...). From that perspective, nothing will change. Browsers will likely continue to support loose HTML DTD, otherwise 90% of sites would be inaccessible. Of course this is only my opinion.

For site development, strict syntax prevents from some potential bugs. But programmers are creatures of habits and designers use all kinds of tools, so XHTML can slow down things a bit. IMO writing XHTML code from scratch is OK, fixing code made by someone else isn't - even with conversion utility ready for use :X

So far I really had to use XHTML only twice. Both times customers were XML-happy - they insisted on XSLT templates, data islands and other corporate "hello world" stuff.
 
About the namespace (XMLNS) you can read here:


In short: The root element of the document must contain an xmlns declaration for the XHTML namespace [XMLNS]. The namespace for XHTML is defined to be
If you haven't experienced any problems with the site (sometimes upgrading to a stricter doctype causes problems with the site because some of the elements ignore deprecated attributes) then upgrade was useful and smart. Using a stricter and newer doctype is always good for overall site compatibility among different browsers.
 
Hi vongrunt & Vragabond

vongrunt: Converting my site was quite easy. The site is like around 20 pages and I was already html 4.01 stict and I was like I noted following alot of the xhtml 1.0 specs anyway. You say that XHTML 1.0 stict can slow things down abit. How so?


Vragabond: I vailidated the pages at w3c.org so I have to changed a few elements, and put block my <input.... /> on my contact.html page. Thanks for the feedback and the link!
The Link: The link you gave me states:

2. The root element of the document must be html.
3. The root element of the document must contain an xmlns declaration for the XHTML namespace [XMLNS]. The namespace for XHTML is defined to be An example root element might look like: <html xmlns=" xml:lang="en" lang="en">

I found that kind of strange cus I tried validating with my root element just being <html> and it validated fine.

So anyway it seems that the spec states that I have to have <html> as my root element which is not problem but then it notes that that root element must contain a xmlns declaration for the XHTML namespace. Hrmm. I am not sure I understand this or why? : )
 
> You say that XHTML 1.0 stict can slow things down abit. How so?

Quite a few times I worked on web sites with designers and other programmers. Some tools designers use don't generate XHTML code. Many web programmers rarely use " and /, or mix single quotes in order to produce code faster (for example, to write inline javascript handler from php/asp). In such cases insisting on strict syntax is waste of time.

Old habits never die. Other than that, XHTML is OK.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top