HTML and XML have been around for a long time now.
Most of us would have heard of HTML. It is there since the beginning of the Internet. HTML is ‘Hypertext Markup language’ and it is mostly used to format and present data. The way the text on your computer screen is sometimes visible in bold and some in italics – well, some of them can be done with HTML. HTML works along with CSS(Cascading style sheets) and Javascript to make the page look better. In HTML, we can only use the specified tags like <head> <body> <title> to work with.
XML is another markup language and its full form is ‘Extensible Markup language’ and its primarily used to describe, store and organize data. We can use our own tags to describe data like <content> <project> or anything.
This is a sample XML file:
<demo>
<title> This is a simple demo post </title>
</demo>
Here I have made my own tags called <demo> and <title>. You can create your tags when working with XML files. Note that since XML files are only used to describe data, they just print the information as such if you open them in a browser. They also have to be used in conjunction with CSS and Javascript to utilize them better.
There are XML editors such as online XML editor, Xerlin and CAM which help you create and edit XML files. However, we can also create XML files with Notepad or Wordpad too.
The created XML files can be viewed with a browser.
Here are the other differences between XML and HTML:
HTML | XML |
1.Used to present data on a page | 1. Used to describe the data on a page |
2. Is NOT case sensitive | 2. Is case sensitive |
3. We have to use only specified tags | 3. We can create our own tags and use them |
4. Tags need not be nested properly | 4. Tags must be nested properly |
This is an example HTML file:
<html>
<head>
<body>
<h1> “Hello World” </h1>
</body>
</head>
</html>
And this is its output when viewed in a browser:
This is a sample XML file:
<?xml version = “1.0”?>
<demo>
<title> This is a simple demo post </title>
</demo>
And this its output when viewed in a browser:
While the HTML file prints the output, the XML file just prints the information as such.
Hope you got a fair idea of the difference between XML and HTML. This is quite a vast topic and I will hopefully cover it in one of my future posts as well!
The previous post can be found here.
Hey Jayanti, I have written on the same title. Do check it out.
— rightpurchasing.com
http://www.rightpurchasing.com/xml-xhtml/
Sure, Sundeep…will do..thanks for stopping by! 🙂
When it comes to technical aspects, I am quite lame. However, I found this post of yours quite insightful. Thank you for sharing. My son is learning some coding and I am sure he would enjoy this, as would so many other people.