XML stands for eXtensible Markup Language and it is used for storing and transferring data. In this guide, we will learn about XML.
What is XML?
XML is a markup language which is used for storing and transporting data. XML doesn’t depend on the platform and the software(programming language). You can write a program in any language on any platform (Operating System) to send, receive or store data using XML.
This is just to show you, how a XML looks. You need not to give too much emphasis on this right now because we will learn this in detail later. For now, you can see it as a document that can be used for sending sender’s name (the value inside <from> tag), receiver’s name (the value inside <to> tag) and the message (the value inside <msg> tag).
<?xml version="1.0" encoding="UTF-8"?> <message> <to>MyReader</to> <from>Chaitanya</from> <msg>Welcome to beginnersbook.com</msg> </message>
The top line
<?xml version="1.0" encoding="UTF-8"?> is called XML prolog. We will discuss it in detail in the separate tutorial. For now just remember that it is an optional line, however if you mention it then it should be the first line in the XML Document.
1. XML is a markup language that focuses on data rather than how the data looks.
2. XML is designed to send, store, receive and display data. In simple words you can say that XML is used for storing and transporting data.
3. XML became a W3C (W3C stands for World Wide Web Consortium, the main international standards organization for the World Wide Web) recommendation on February 10, 1998.
4. XML is different from HTML. XML focuses on data while HTML focuses on how the data looks.
5. XML does not depend on software and hardware, it is platform and programming language independent.
6. Unlike HTML where most of the tags are predefined, XML doesn’t have predefined tags, rather you have to create your own tags.
Why we need XML?
Since there are systems with different-different operating systems having data in different formats. In order to transfer the data between these systems is a difficult task as the data needs to converted in compatible formats before it can be used on other system. With XML, it is so easy to transfer data between such systems as XML doesn’t depend on platform and the language.
XML is a simple document with the data, which can be used to store and transfer data between any systems irrespective of their hardware and software compatibilities.