XML vs HTML

By: Emiley J Viewed: 153192 times  Printer Friendly Format    


Some new programmers tend to think that XML is a replacement for HTML. It is NOT. XML and HTML were designed with different goals in mind. XML was designed to transport and store data, with focus on what data is where as HTML was designed to display data, with focus on how data looks. So HTML is about displaying information,
while XML is about transporting information.

Another thing to note is that XML Does Not DO Anything!

XML was created to structure, store, and transport information. So you will have to use some other technology or programming language to handle and process XML document in order to DO something.

The following example is a note to the teacher , from a student, stored as XML:

 

<note>
<to>teacher</to>
<from>student</from>
<heading>Leave</heading>
<body>I was sick yesterday</body>
</note>

The note above is quite self descriptive. It has sender and receiver information, it also has a heading and a message body.  But still, this XML document does not DO anything. It is just information wrapped in tags. Someone must write a piece of software maybe in Java,C++,ASP,PHP etc to send this note, receive or display it somewhere.

 

With XML You can add your own Tags

The tags in the example above like <to> and <from> are not defined in any XML standard. These tags are "invented" by the author of the XML document. So you can add your own tags as necessary. Therefore there are no predefined tags or the so called keywords that you have to use in XML.  This is in contrast to HTML where the tags are predefined and if you use your own tag it will be ignored by the browsers.



Most Viewed Articles (in xml )

Latest Articles (in xml)

Comment on this tutorial