XML stands for EXtensible Markup Language
XML is s text-based markup language, by XML we can create our own tags which is used as a data indexing in web application. No predefined tags are available in XML. XML is extended from Standard Generalized Markup Language(SGML) The tags which we are created using XML, that are identifying or indexing the data, also organize the data in such a way that the data can be human-readable and machine-readable. XML helps to store the data in an efficient way and it uses to send the data over POST or GET request of server. It was developed to overcome the limitations of HTML. All the XML has a root element. In the case of back-end development, we can write a program in any language on any Operating System which can be sent, received, or stored using XML. XML is not platform dependent and also not language-dependent.
History of XML
IBM created a first markup language in 1960. It was known as GML(Generalized Markup Language) . Then SGML has come from this and it became standard for many different markup languages, like XML is derived from Standard Generalized Markup Language(SGML), this SGML invented in the year 1970 by Charles F. Goldfarb, Ray Lorie and Ed Mosher at IBM. But it was accepted by the ISO standard 8879 in the year 1986. After this in 1992 Tim Berners Lee designs HTML from SGML. Then XML comes in mind, a group of eleven members and roughly 150 supporting members are working as group for XML development. Jon Bosak from Sun Micro Systems was the main motivator for the creation of XML. The development of XML was started from 1996 and in 10th of February of 1998, XML v1.0 released and got the W3C Recommendation. James Clark was the Technical Lead of the Working Group and he contribute the syntax of empty-element ( <empty />). The XML specifications was 26 pages long at time of released, whereas SGML specifications was 600 pages long, so XML is very much accepted by the users in that time.
After 2 years, in 2000 the second edition of XML released and got the W3C Recommendation, then in 2004 3rd edition of XML v1.1 released and got the W3C Recommendation.
XML is an old technology nowadays, now JSON is mostly used instead of XML.
Some extensions of core XML specification of future development :
- XInclude :It is use to divide a long documents into multiple files, it is work as a generic mechanism which merge XML documents.
- Canonical XML : It is a algorithm for determining whether two XML documents are the same or not.
- XML Query Language(XQL) : It is a query language which transforms the data into readable XML format, such as text, or converts the data into receiver specific extension.
- XML Signatures :A standard for digitally signing XML document
- XFragment :It is use to make sense of XML documents that are not be well-formed.
- XML Encryption : A standard for digital data which are encrypted in XML.
Sample code of XML :
Here we are defining a MCQ type question, the question has 4 options of answers, where the correct option is B. Here the question, options of answer, and the correct answer are the data which are stored in XML format by using the tags, <question>, <answer>, <A>, <B>, <C>, <D>, <answer value>. Here the root element is <question>
Characteristics of XML
- The main characteristic of XML is we can make our own tags in XML according to our need.
- XML always has a root element, all the data stored in tree structure.
- XML is always well formed, that all the XML document has written in a well formed way, each tags are define the types of data that are holding, see the examples.
- It is case Sensitive, that is, all the element type names are case-sensitive.Also attribute names and values are also case-sensitive.
for example <Website name =’gfg’/> and <WEBSITE NAME=”GFG”/>, if they occurred in the same file then they are treated as different attributes.
- XML document must have a closing tag of all the defined tags, otherwise the data are not store perfectly or data missing may occurs.
- We can handles variety of data with complex data structure easily in XML. All types of data can be retrieve and stored by XML very easily.
- XML allows validation of error using DTD and Schema, his validation ensures that the XML document has any syntax error or not.
Advantages of XML
- Main advantages of XML is, it is a text based, human and machine readable markup language.
- The data stored and transported using XML can be changed at any point of time without affecting the original data.
- It is based on international standards. So using if XML is same over the world.
- The hierarchical structure of XML is suitable for most of all the cases.
- Xml supports unicode, so that all the information written in human language can be communicated using XML.
- It is platform independent, XML can use any information regardless of platform
- XML also gives framework to define markup languages
- XML is dynamic in nature.
Disadvantages of XML
- XML syntax is redundant or large relative to binary representation of same data.
- XML is not much good at handling of large data.
- Difficult to optimize query in XML.
- The redundancy in syntax of XML causes higher storage and transportation cost.
- Linking between XML document requires XLink, which is more complex than HTML hyperlinks.
- It is hard to find correct and efficient XML parser for checking error.
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : Akanksha_Rai