In this post, we will understand the difference between HTML and XML.
HTML
It refers to Hyper Text Markup Language.
It helps create web pages and applications.
It is a markup language.
It helps create static pages as well.
It helps display data.
It doesn’t transport data.
HyperText helps define link between multiple web pages.
Markup Language helps define text document using tags, which gives a structure to the web page.
It helps annotate the text so that a system can understand it and use it.
It ignores minor errors.
It is not case sensitive.
There are specific number of tags in HTML.
These tags are predefined.
It doesn’t preserve white spaces.
Closing tags are not a necessity.
An example of HTML −
Example
<!DOCTYPE html> <html> <head> <title>My title</title> </head> <body> <h1>title</h1> <p>A sample</p> </body> </html>
Output
XML
XML stands for ‘eXtensible Markup Language’.
It is case sensitive.
It doesn’t allow errors.
It helps provide a framework that would define markup languages.
The tags are user defined.
These tags are extensible.
The white space can be preserved.
The tags help describe data.
These tags aren’t used to display data.
The closing tags are required.
It helps create web pages and applications.
It is dynamic since it helps transport data.
The design goals focus on simplicity, usability across internet.
It supports Unicode.
It can also be used to represent arbitrary data structures required for web services.
An example of XML −
Example
<?xml version = "1.0"?> <contactinfo> <address category = "type"> <name>Mark</name> <College>MIT</College> <mobile>6787878</mobile> </address> </contactinfo>
Output
Mark MIT 6787878