HTML vs XML


HTML

HTML stands for HyperText Markup Language which is a language used to describe the structure of a web page. It consists of various HTML element which is composed of HTML tags and their content.

HTML is a hypertext language so we can create a chain of links of documents. The current version of HTML is HTML5. HTML is static and it can ignore small errors and in it, closing tags are not necessary.

Let us see an example of HTML −

Example

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>HTML</title>
</head>
<body>
<h1 style="text-align: center;color:#db133a;">HTML</h1>
<h3 style="text-align: center;">I'm a HTML document.</h3>
</body>
</html>

Output

XML

XML stands for eXtensible Markup Language which is a language used to transfer data not to structure data. It is dynamic and it reports all errors and in its closing tags are necessary. It is basically a textual data format with strong support via Unicode for different human languages. The current version of XML is XML1.1.

Let us see an example of XML −

<?xml version="1.0" encoding="UTF-8"?>
<fullname>
<firstname>John</firstname>
<lastname>Miller</lastname>
</fullname>

Output

Let us now see some of the differences −

HTMLXML
HTML stands for HyperText Markup Language which is a language used to describe the structure of a web page. It consists of various HTML element which is composed of HTML tags and their content.XML stands for eXtensible Markup Language which is a language used to transfer data not to structure data
HTML is static because it is used to display data.XML is dynamic and used to transfer data.
It is a presentation language.It is not a presentation language.
It is not necessary to use a closing tag.It is mandatory to use a closing tag.
Predefined tags like <p>, <strong>, <head>, etc are in HTML.Define your own tags in XML.
HTML does not preserve whitespacesXML preserve whitespaces.
HTML is case insensitive.XML is case sensitive.

Updated on: 22-Dec-2021

401 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements