(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:
The following code shows an HTML document that displays the same information on a web page:
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.