Introduction of XML -: Extension Markup Language is a full name of XML .It (XML) is used for storing and transferring data. You can create your tag in XML. Like the HTML language XML is based on SGML( Standard Generalized Markup Language). XML was designed with the Web in mind. XML doesn’t depend any platform or any software (programming language). We can write a program in any language on any platform (Operating System) to send, receive or store data using XML. It was designed to store and transfer data. XML was designed both human and machine readable.
XML was created by the W3C. XML became a W3C and W3C stands for World Wide Web Consortium, the main international standards organization for the World Wide Web recommendation on February 10, 1998.
Necessary of XML -: HTML is very famous language. We can view the simplest HTML tags on virtually any device, from palmtops to mainframes and we can even convert HTML markup into voice and other formats with the right tools. Look this example
<p><b>Mrs. vikram singh</b>
1401 Main Jaipur
Jhotwada, Pin 302012</p>
The problem with HTML is that it was designed with humans in mind. Even without viewing the above HTML document in a browser, you and I can figure out that it is someone’s postal address. A humans, you and I have the intelligence to understand the meaning and intent of most documents. A machine, unfortunately, can’t do that.
In other words we can say that the there are systems with different-different operating systems having data in different formats. In order to transfer the data between these systems are very difficult task as the data needs to converted in compatible formats before it can be used on other system. With the 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 compatibility.
Difference between XML and HTML
XML and HTML are developed for different purpose.
- XML was designed to transfer data,platform changing, ,data sharing.
- HTML was designed to display data – with focus on how data looks
- XML tags are not predefined like HTML tags are. We can create XML tags.
Rules For writing a XML -: We know that in the XML has no predefined tags. We can create any tag in XML language.The tags are necessary to close. For example
<?xml version="1.0" encoding="UTF-8"?>
<to>Mr vikram singh</to>
<msg>Welcome to netnic xml programming</msg>
For this example we have created tags. All tags are closed. Like the HTML language first tag close in last and last one close in the first.
Tags, elements, and attributes -: There are three common terms used to describe parts of an XML document: tags, elements, and attributes.
- Tags-: A tag is the text between the left angle bracket ( <) and the right angle bracket ( >). There are starting tags (such as ) and ending tags (such as ).
- Elements-: An element is the starting tag and the ending tag. All the data are inserted between these tags.For sample above, the element has <first_name>Vikram</first_name> and <last_name>singh</last_name>. The result is vikram singh.
- Attributes-: An attribute is a name-value pair inside the starting tag of an element.
Extension of XML –: Like HTML file the XML file extension is a .XML We can create XML file in notepad and save this file extension .XML suppose we give the XML file name netnic the file name given here netnic.xml and save it.