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">
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âŚ
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.
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.
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.
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.