What is XML used for

What is XML?

XML is everywhere, both programmers and non programmers have to deal with XML data constantly. XML has become the de facto standard for exchange document between machines, operating systems, applications, organizations, corporations, government departments, etc.

A document can be anything, a report, a life insurance policy, a travel itinerary, a piece of weather data provided by a Web service, etc.

Its very common for a programmer need to parse, transform, display, create XML document and there are a lot of tools and library can help.

Used in Javascript based Web applications

Many Web applications use AJAX technology to communicate with server and browser, user can get feedback and update without reload the page. The data transferred between them can be XML document. Here is an example

<?xml version="1.0" encoding="utf-8"?>

There are debates about use XML or JSON, the main reasons are JSON is less verbose and can be processed directly in Javascript language, but JSON is very primitive and limited compared to XML, it only useful in some special environments.

In many other situations, JSON never replace XML because JSON is not supposed to represent a document.

XML SOAP Web service

A Web service using SOAP protocol to send data to client request as XML document. For example, the weather data service provided by NDFD.

Project configuration file

Many Java software or library use XML as default configuration file, like the Maven, Spring, Struts, etc. IDE like Visual Studio use XML as solution configuration file, usually edited through GUI, not direct editing.

Small business or enterprise document

For example, a purchase order can be represented as XML document and exchange between different enterprise and different ERP systems.