Difference Between HTML and XML
There are many differences between HTML (Hyper Text Markup Language) and XML (eXtensible Markup Language). HTML is a markup language used for displaying information, while XML markup is used for describing data of virtually any type.
HTML (Hyper Text Markup Language)
It is used to create web pages and web applications. It is a markup language which means it makes the text more interactive and dynamic. It has a variety of tag and attributes for defining the layout and structure of the web document. It is designed to display data in a formatted manner. By HTML we can create our own static page. It is used for displaying the data not to transport the data. Hypertext defines the link between the web pages. A markup language is used to define the text document within tag which defines the structure of web pages. This language is used to annotate (make notes for the computer) text so that a machine can understand it and manipulate text accordingly. A HTML document has the extension .htm or .html. You can edit HTML code is any basic code editor, even notepad. The edited code can be executed in any browser. Browsers render the tags used and present the content you want to display with or without applied formatting.
XML (eXtensible Markup Language)
It is also used to create web pages and web applications but mainly for android application. It is dynamic because it is used to transport the data not for displaying the data. The design goals of XML focus on simplicity, generality, and usability across the Internet. It is a textual data format with strong support via Unicode for different human languages. It's popularly used or transfer of data. It is case sensitive and offers you to define markup elements and generate customized markup language. The basic unit in the XML is known as an element. Extension of XML file is .xml .
Here’s the basic difference between HTML and XML :-
Basis Of Distinction |
HTML |
XML |
Full Form |
Hyper Text Markup Language |
eXtensible Markup Language |
File Extension |
The file extension of HTML is .htm or .html . |
The file extension of XML is .xml . |
Developed by |
WHATWG |
World Wide Web Consortium |
First Appeared Year |
1993 |
1998 |
Purpose |
HTML is used to display data and focuses on how data looks. |
XML is a software and hardware independent tool used to transport and store data. It focuses on what data is. |
Markup Type |
It is Semantic Markup. |
It is Display Markup |
Language Case Type |
HTML is not Case sensitive |
XML is Case sensitive. |
Language Type |
It is a markup language. |
It provides framework to define markup languages. |
Type |
HTML is static. |
XML is dynamic. |
Driven By |
It is Format Driven. |
It is Content Driven. |
Errors |
HTML can ignore small errors. |
XML does not allow errors. |
Structural details |
It is not provided. |
It is provided |
Tags |
HTML tags are predefined tags and there are limited number of tags. |
XML tags are user defined tags and are extensible. |
Tags Purpose |
HTML tags are used for displaying the data. |
XML tags are used for describing the data not for displaying. |
End of tags |
The closing tag is not always required. |
The closing tag is essential in a well-formed XML document. |
Syntax |
It does not check syntax. |
It does a syntax check. |
Whitespace |
HTML does not preserve white spaces. |
White space can be preserved in XML. |
Nesting |
Does not have any effect on the code. |
Should be done appropriately. |
Quotes |
They are not required for the values of attribute. |
It is required around XML attribute values. |
Object Support |
It offers native object support. |
Objects have to be expressed by conventions, mostly using attributes and elements. |
Namespaces |
Does not support the concept of namespaces. Naming collisions can be avoided either using a prefix in an object member name or by nesting objects. |
XML provides support for namespaces which helps you to remove the risk of name collisions when combining with other documents. |
Size |
The syntax is very brief and yield formatted text. |
Documents size are mostly lengthy, especially when an element-centric approach is used in formatting. |
Formatting Decision |
Provides direct mapping for application data. |
Required more significant effort to map application types to XML elements and attributes. |
Null Support |
Natively recognizes the null value. |
Need to use xsi:nil on elements in an XML instance document and also need to import the corresponding namespace. |
Parsing in Javascript |
No extra application code required to parse text. For this purpose, you can use the evaluation function of JavaScript. |
Requires an XML DOM implementation and application code to map text back into JavaScript objects. |
Learning Curve |
HTML is a simple technology stack that is familiar to developers. |
It is very hard as you need yo learn technologies like DOM, XML Scheme, XPath, etc. |
Codes |
My First HeadingMy first paragraph.
|
|