What is difference between SGML, HTML and XML?
- SGML stands for Standard Globalized Markup language is the one used for defining standard markup languages. In simple words it defines how a document should looks like.
- HTML stands for Hyper Text markup language is a standard Markup language based on SGML and it will be used for creating Web Pages. Rules defining the markup is present inside a DTD and DTD is created using SGML.
- XML stands for Extensible markup language is derived from SGML and its purpose was cattering growing need of internet. HTML had some limitations which was over came by XML. XML is simply a subset of XML which will be used for representing Data.
What is Doc type?
When you try to create a HTML page using tools like Dreamweaver or Visual studio you will find following line at the top of the document always.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Have you ever wondered what it is?
It’s simply an instruction to the web browser about the version of HTML the page is written in. With doctype we refers a DTD which defines how HTML document should be structured, what all tags are allowed, what should be the parent, what should be the child etc. In short DTD contain rules.
How HTML worked for me with Doctype then?
Most of the browser said “It’s ok if you won’t provide DTD. I can understand HTML well. I know its rule and so I know how to render it”.
This is the reason why most of the developers are unaware about DTD and doctype.
|
How HTML 5 is different from previous versions?
HTML 5 is not based on SGML hence it won’t require DTD. It’s all together new markup language and have its own parsing rules. Its specifications and syntaxes closely resembles with prior version but it’s all together a new language.
In case of HTML 5 doctype is quite simple.
<!DOCTYPE html>
Now as per the w3.org “DOCTYPEs is required in top of every HTML document despite of its HTML4 or HTML 5. When omitted, browsers tend to use a different rendering mode that is incompatible with some specifications. Including the DOCTYPE in a document ensures that the browser makes a best-effort attempt at following the relevant specifications.”
Source Collected from Codeproject.com
No comments :
Post a Comment