What is XML File & What is It Used For?
For the past 20 years, XML is being used as a data format through which data can be easily transported between different networks, applications, and organizations.
What is XML?
- The full form of
XML is Extensible Markup Language. XML is a type of markup language and is used
to store and organize data.
- The way of
writing code in XML is exactly the same as in HTML. Tags are used in both HTML
and XML.
- As you know HTML
is also a markup language but it is used to display the data in the webpage.
- HTML had many
shortcomings, so XML was developed. It meets the limitations of HTML.
- Using different
tags in HTML, it is described how the contents of the page (such as text,
images etc.) will be displayed on the user's screen, whereas in XML, data is
stored and managed using tags.
- What is XML is
platform independent and language independent. That is, it runs in any device
and can be used with any language.
- We write the code
of XML in a separate file and save that file with .xml extension.
- It can be used by
combining XML and HTML. The combined version of XML and HTML is called X-HTML.
- After creating an XML document, it can also be used as a database. All data in XML is saved as plain text, so it is very easy to access it through any application.
How Does XML Work?
Actually the code
in an XML document is written in a hierarchical structure i.e. in a
hierarchical manner and an XML parser is required to read it. Parser divides
this document into elements, attributes, and other small parts. These different
parts are accessed and displayed by an application as per the requirement or
any operation is performed on it.
If there is any
mistake in the format of the document then it is reported by the parser as an
error.
The data can be
sent through the parser to be processed on some of the following applications:
- Any web browser
like Chrome, Firefox etc.
- a word processor
such as Microsoft Word
- to another
database such as SQL Server
- Can be imported
into any online tool
- Own programs written in Java, C, C++ etc. can also access it.
Advantages of XML
XML is a very
powerful language and it is different from other languages due to some of its
advantages. Let us know about these advantages.
- Through this we
can easily handle very complex types of data.
- Through this we
can share data.
- By this the
description of data can be given in text format.
- The format of XML
can be read by humans as well as computers.
- Data in XML is
handled in the structure of a tree, due to which its speed is very fast.
- Through this, we
can store the data for a long time and can also use it again.
- Data in XML is
described by markup language.
- It is used to create other languages. Such as – XHTML, WSDL, WAP, RDF, and SMIL etc.
Disadvantages of XML
XML has some
drawbacks that keep it behind other languages. Let us try to know about them.
- It is not able to
store binary data such as – image.
- The syntax of XML
is too verbose and redundant. That is, it is very explanatory.
- It does not
support any kind of data types. Such as- integer, strings etc.
- It does not
support array.
- In this the
hierarchical representation of the document is limited.
- It is difficult
to use namespaces in this.
- XML has no
application processing system. XML has to depend on HTML for processing.
- It is very difficult to setup the document in this.
Applications of XML
It is used for many tasks. Some of these are given below:-- XML can be used
to maintain large websites.
- XML is used to
exchange information between companies.
- XML can also be
used to load and unload databases.
- XML can be merged
with style sheets.
- Any kind of data can be converted as an XML document.
A Simple XML Program:
Below is its
simple program:-
<?xml version="1.0"
encoding="ISO-8859-1"?>
<note> <to>Viral</to>
<from>Mayank</from>
<heading>Hellor</heading>
<body>How are You?</body> </note>
What is the Difference Between XML and HTML?
This question
must be coming in your mind from the beginning that what is the difference
between HTML and XML? After all, the way of writing code is the same in both.
So to understand this, read the points given below:
HTML XML
HTML is used to
display data. XML is
designed to store and transport data.
If both XML and HTML are being used,
then HTML determines how the
data from
the XML file will be visible to the user.
All tags are predefined in HTML.
It is not necessary to put closing tag The
closing tag is required in XML.
in HTML.
HTML is not case
sensitive.
Comments
Post a Comment