What is XML? | Explained
What is XML?
In this article, we will discuss the XML data format in detail.
So, if you are looking for a detailed simplified explanation to understand the XML, you are on the right place!
What is XML?
XML stands for eXtensible Markup Language. So, as its name suggests, XML is a markup language. Markup language basically uses tags to define the data or elements.
It is very similar to HTML. Here are the differences between HTML and XML.
HTML is also a markup language, which is mainly used to display data on the browser. For example, in HTML, we can use the following tags such as – <head>, <body>, <b>, <image> etc. For every tag, you need to mention the starting tag (<head>) and end tag (</head>). So, HTML uses the predefined markup.
On the other hand, XML is used for store and transport data. It is platform-independent. So, we can transport data from one platform to another platform easily using XML. XML data is represented with the help of tags. Unlike HTML, in XML we can create our own markup.
As we have discussed earlier, XML is mainly used to store data and transfer data. In the web development, we use the XML to store the configuration information in plain text, which make it easier to import and export.
HTML used for presentation of the data, while XML serves the purpose of storing the data.
The syntax for XML is very simple. It is a tag oriented markup language.
As we have discussed, XML does not have any predefined tags. The user can create their own tags.
Here is a snapshot of a XML:
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type='text/xsl'?> <class> <Student_1> <student_name> John </student_name> <student_id> 33 </student_id> <branch> Computer Science Eng. </branch> </Student_1> </class>
In this example, we have used the tag – <Student_1>, <student_name>, <student_id>, <branch>. These are definitely not the predefined tags.
How to open/edit the XML file?
Technically, you can open XML file in any text editor such as notepad, Vi, Vim etc. However, to view the XML file, you can open the file in any web browser.
You can right click on the XML file and open with notepad, as shown below:
As you can see clearly, the XML file is not displaying in proper format. Even though the XML file is really a text file, the notepad was not designed to display the XML content in proper format.
Now, let’s try to open the same XML file with Notepad++
As you can see above, the Notepad++ is able to display the XML with syntax highlighting. Notepad++ is a pretty advanced text editor than a basic notepad.
How to just view XML data?
If you got an XML file and just want to view it, you can just use any web browser to view the data.
We will now open the same XML file with a web browser. You can right-click on the XML file and open it with any web browser you want. Otherwise, you can just double-click on the XML file. That should open the file with your default web browser.
Best XML Editor
There are several XML editors available online. But, here, we will only discuss the best XML editors that are currently available for free:
- Notepad++: The Notepad++ is an advanced text editor. The best thing is it’s completely FREE. You can use the syntax highlighting features for various languages. The editor is fully customizable and there are tons of plug-ins that are available to meet your requirement.
- XmlPad: XmlPad is another FREE text editor which can be easily used for editing XML file. It is available for both Windows and Mac operating systems. You can use the syntax highlight feature for XML.
- Microsoft XML Notepad: This is another open-source FREE notepad that you can use for editing the XML file. One of the interesting features of this editor is, it displays the XML file in a tree structure. The tree structure view is really helpful in managing complex large XML files.
- TextEdit: TextEdit is a FREE text editor that you can use for editing the XML file. If you want to edit a really large XML file, this is the editor you want to go for. The rich syntax highlighting and bookmarking feature makes it a really good editor for XML. This is considered to be one of the best XML editors.
- XML Copy Editor: This is a completely FREE editor. The editor is available on all three platforms – Windows, Mac, and Linux.
Beautify XML Online
You can beautify XML online. There are various XML beautifier tools, you can use for editing such as –
XML Formatter Online
If you are looking for XML formatter online, here is a couple of online tool you can make use of:
XML Parser Online
If you are looking for XML parser online, here are a couple of online tools:
However, in every modern programming language, there are rich libraries to parse XML data.
Difference between HTML and XML
The basic differences between HTML and XML are:
- HTML is used for display the content/data.
- XML is used for store/transfer the data.
- HTML tags are predefined.
- In XML, tags are not predefined. The user can create user-defined tags in XML.
Difference between XML and JSON
There are several differences between XML and JSON:
- XML uses the tags to define the data.
- JSON uses key-value pairs to define data.
- XML is a markup language and uses tags.
- In XML, we may have to repeat the tags for complex data.
In JSON, the data can be represented in terms of objects. Therefore, JSON is lightweight and quicker than XML.
XML to JSON Converter Online
If you want XML to JSON Converter online, you can use the following sites:
In this article, I have tried to cover the basics of XML data and various other aspects of XML such as XML formatter, XML parser etc.
We have briefly discussed the difference between XML and JSON. However, if you want to know JSON in details, please CLICK HERE.
Is there anything you’d like to add or clarify? Let me know in the comments!