+2 votes
501 views
I don't know the purpose of xml?

can any one explain what is xml?

where it is used in realtime? and give some examples
asked Jul 30, 2015 in Computer Science - IT by gypsiii
edited May 25, 2016 by slow_learner | 501 views

2 Answers

+1 vote
Selected Ans.

XML stands for EXtensible Markup Language.

But What is XML ?

xml is used to store and transport data.At the same time html is used to display data.

There are different formats in which datas can be transported,and it differs from system to system.Most of the time data is lost when we convert one format to another.Hence we can use xml format for data transfer.

XML stores data in plain text format. Hence it is software- and hardware-independent to store and transport data.

In detail:

A Web service is a method of communication between two electronic devices over a network.

Example using Webservice (webservice in .NET) :

  public class WebService1 : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }
    }


Consider you need to pass this data to an Android application and get "Hello World".

Solution would be you need to access this webservice.

But how ?

You can use that url to access that webservice.

These files with webservice will be hosted in any server.

Final output will be an XML file (we can also produce output in JSON format.)

In the above image you can see output in xml format

Let me explain you with another example :

Consider you need to create an android app in eclipse .

You run eclipse to create application.

The window will show you :

We have not added any controls still project will display you a window with HelloWorld..

If you check the code for that window it will show you :

Design View :

Code view :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

</RelativeLayout>

 

Above codings are written in xml.

To create layouts xml can be used !

We use datas in xml file formats in webservices . 

XML is nothing but a markup  language which are human readable format.

Hope that was clear....If you need more industrial applications you can find here

xml tutorial

 

 

answered Jul 30, 2015 by slow_learner
edited Nov 19, 2015 by slow_learner
+1 vote

Xml stands for Extensible Markup Language.It describes the class of data objects called xml documents and partially describes the behaviour of computer program which process them.XML is normally used for transporting data through feeds, API calls etc.If we have 10 different programs that need to be able to share data and each has its own proprietary format. To convert from any one proprietary format to any other directly would require 90 different filters to do the possible conversions. Converting to and from XML would only require 20. xml is used to store and transport data.

For example:

 

<?Xml version="1.0" encoding="ISO-8859-1" ?>

<employee>

<first name>Shikha</first name>

<last name>Tyagi</last name>

</employee>

 

Another example

 

<? Xml version="1.0" encoding="ISO-8859-1" ?>

<note>

<to>Delhi</to>

<from>America</from>

</note>
answered Jan 12, 2016 by Shikha tyagi
edited Jan 13, 2016 by slow_learner