Doctype XML namespace reference

Hello, I have recently being asked as a consultant to review website
code structure and most of them still have the XML reference, which
has long been abandoned. Most developers today do not use that anymore
correct?

That is actually the first thing that I notice when reviewing code and I
advise them to change that.

Are you talking about the doctype and namespaces? If so, they are still perfectly valid, and don’t necessarily have to be abandoned. The html 5 specs don’t require them, but they are still perfectly valid and proper.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
1 Like

Yeah that is what I was talking about
so it is an old doctype of <!DOCTYPE html> that can still be used?
It was abandoned though wasnt it?
even if it is still valid is it bad practice to still use it?

That one is actually the “official” html5 doctype. It’s not required, but it’s valid. Heck, you can use the old HTML 2.0 doctype if you want.

All the doctype does is give the browser (or whatever you’re using to parse the document) directions on how to process it. It helps browsers (especially the older IE browsers) from changing display modes.

So you are saying use whatever doctype, and it wont matter. As long as you have one?
I remember I was told once here that its best to just use the HTML5 doctype…

No, that’s NOT what I’m saying.

For new development, then yes, you could argue that using the HTML5 doctype/specs are the better choice. But if you’ve got a site completely done (and done well) in HTML 4.01 Strict, then you don’t HAVE to change it unless you want to use some of the elements that are in the newer specifications.

A lot will depend on your audience. If you’re sure your potential clients will be using modern browsers, then you should lean towards using the latest and greatest standards. But if you’ve got an aging population, or one that just doesn’t have access to the newer operating systems/browsers, then using an older doctype and spec may just be the wiser option.

3 Likes

Think of it this way. You’ve been asked to critique a volume of Shakespeare’s plays for purposes of recommending it for high school reading. You grab the book from the library and on the front is stuck a post-it that says “This book is written in Olde English”.

If your critique consists of “the post-it should be re-written to say ‘this book is written in Modern English’” then you have missed the point. Your critique may well be “the book should be written in Modern English”, but that’s a very different thing.

1 Like

And if you say it should, then you better have good reasons why something should be re-written other than it’s the latest and greatest. There are costs and risks to re-writes. The person doing the work needs to be intimately familiar with the standards from the old to the new to know the pitfalls and hiccups which can occur. They would need to know which elements have replaced which, which are new and can/should be implemented.

For example, if a site is written is fixed and table based, you can make a case that the tables should be replaced to a more flexible design because it’ll be better for mobile users, and their retention rates should rise and hosting costs could go down depending on their traffic.

2 Likes

ok got it.

Of course you can - HTML 5 uses the short version of the HTML 2 SGML doctype tag as an HTML tag.

<!doctype html> is the short version of the SGML doctype tag for HTML 2, 3 and 4. The same tag is an HTML tag in HTML 5 (since HTML 5 doesn’t follow the SGML markup standards). So it is valid in all versions of HTML except HTML 1.

3 Likes

wow that is a mouthful :grinning:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.