Why XML instead of HTML?


HTML is a markup language used for displaying information, while XML markup is used for describing data of virtually any type. In other words, we can say that HTML deals with how to present whereas XML deals with what to present.
Lets take an example In HTML a student might be described using a definition name, definition data, an unordered list, and list items. But none of these elements actually have anything to do with student.

The HTML is as under:
<HTML>
<body>
<dt>Mayank</dt>
<dd> Of Science Stream</dd>
<ul>
<li>Standard: Eleventh
<li>School: ABC Pvt. School
</ul>
<body>
</html>
And the XML for this is:
<XML>
<STUDENT>
<NAME>Mayank</NAME>
<STREAM>Science</STREAM>
<STANDARD>Eleventh</STANDARD>
<SCHOOL>ABC Pvt. School</SCHOOL>
</STUDENT>
</XML>
Instead of generic tags like <dt> and <li>, this listing uses meaningful tags like
<STUDENT>, <NAME>, <STREAM>, and <STANDARD>.
X

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now