Every thing you need to know about XML : Introduction to XML and key features

In thisarticle we will discuss basics of XML, Key features of XML where it is used what are the real time applications of the XML in day to day life.

What is XML

XML Stands for extensible mark up language. XML is a mark up language just like HTML but with some modifications. It is designed to be a self-descriptive language.It is also the recommendation of the W3C (world wide web consoritium).
Here is the piece of XML code which defines the delivery of the parcel to particular address.

    <from> Dattatrey patil, 4th street, majestic, Bangalore </from>
    <Item> XML Coding book </Item>
    <to>   vrashikesh patil , 3rd street vijaypur </to>

So in the above example “address” indicates the main tag or root tag of the document. which is the start of the document. “from” is another tag which is the child tag of the address tag, “Item“, “to” are also tags whose parent is again address itself.
So above example is a good illustration of DOM (document object model structure) where complete XML document will be shown as the “tree like structure“.

What is XML and Key Features

Difference between XML and HTML

  • XML is intended to carry data and store the data.
  • HTML is designed to display the data.
  • HTML contains some set of pre defined tags which are used to describe the data.
  • XML does not contain any pre defined tags but programmer can create their own tags.

No pre defined tags in XML

Unlike HTML there are no pre-defined tags in XML. As a programmer we need to create our own tags according to our needs. here the programmer has got liberty to create tags as they want.
But if we are using HTML then we need to use the tags which are pre defined and if we need something else (custom tags) then there is no option.

Why XML is called Extensible ?

In XML the letter “X” stands for Extensible in the sense it can be modified or changed to something else.
Most of the applications will work perfectly if the previous tags are removed pr new tags are added.
For example :
Consider the above piece of code where we will remove item, instead we will add 2 new tags say item 1 and item 2. so the document will looklike this.

    <from> Dattatrey patil, 4th street, majestic, Bangalore </from>
    <item1> XML book by dattatrey </item1>
    <item2> XML bookby vrashikesh </item2>
    <to>   vrashikesh patil , 3rd street vijaypur </to>

So still the above piece of code will be working fine though we have removed the “item” tag.

XML Makes Life Easier

Well now we know what XML and how it is used, let us see some points which makes XML a good choice for programmers.

  • XML makes data sharing very easy
  • Transportation of data is easy using XML
  • XML is platform independent
  • data availability is made easier with XML

Advantages of XML

  • XML is extensible in nature that means we can create custom tags
  • Easy to read for humans and computers
  • It’s completely portable and compitable with java coding language
  • As it’s a platform independent language can be used on any system.
  • Unicode is supported by XML
  • With the help of XML data can be stored and transported at any
  • XML has made data sharing very easy in between systems.

Disadvantages of XML

  • When dealing with large volumes of data as it loads whole document, storage and transportation costs are high.
  • When compared to other text-based languages, XML is redundent.
  • XML is less readable compared with other text based formats.
  • Generally XML codes will be lengthy and file sizes will be higher.
  • Last but not least XML does not support an array

Difference between XML and HTML

It’s a markup languagestandard markup language used for defining other languages
Not case sensitive It’s case sensitive
It’s presentation language as wellIt’s not a presentation language
Has got it’s own pre-defined tagsTags are not pre-defined here programmer can create own tags.
Closing tags are not mandatoryEvery opening tag must have closing tag here.
While spaces are not preserved.Here white spaces are preserved.
Mainly used for displaying the dataUsed for transporting the data
Static in natureDynamic in nature
difference between html and xml

Leave a Comment

Your email address will not be published. Required fields are marked *