Computer Science - Class 12
Solutions to CBSE Sample Paper - Computer Science Class 12

(ii) Give one difference between XML and HTML.

Answer

Answer by student

XML

HTML

XML is used to store and carry data, not to display it.

HTML is used to display data, not to store or carry it.

Detailed answer by teachoo

XML and HTML are both markup languages commonly used in web design and development, but they have several points of difference between them. These include :

XML

HTML

Language type: XML is both a markup language and a framework for defining other markup languages , as you can transport it for use in another language.

Language type: HTML is a predefined markup language that displays data on web pages.

Data type: XML is used to store and carry data, not to display it.

Data type: HTML is used to display data, not to store or carry it.

Tags: XML tags are user-defined and extensible, meaning that you can create your own tags and use them in any way you want.

Tags: HTML tags are predefined and limited, meaning that you have to use the tags that are already available and follow their rules.

Syntax: XML has a strict syntax that does not allow errors or missing tags.

Syntax: HTML has a flexible syntax that can ignore small errors or missing tags.

For example, the following code shows an XML document that defines a book with its title, author, and price:

XML document that defines a book with its title, author, and price - Teachoo.png

The following code shows an HTML document that displays the same information on a web page:

HTML document that displays a book with its title, author, and price - Teachoo.png

As you can see, the XML document uses user-defined tags such as <book> , <title> , <author> , and <price> to describe the data. The HTML document uses predefined tags such as <html> , <head> , <title> , <body> , <h1> , and <p> to display the data.

Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo.