Introduction to XML and AJAX

In this tutorial, the basic concepts of eXtensible Markup Language (XML) and Asynchronous JavaScript and XML (AJAX) are described. 

 

Basics of XML

XML, which stands for eXtensible Markup Language is a general-purpose specification for creating custom markup languages. It is classified as an extensible language, because it allows the user to define the mark-up elements. XML’s purpose is to aid information systems in sharing semi-structured data, especially via the Internet, to encode documents, and to serialize data.

XML is a markup language much like HTML. But they serve different purposes. HTML was designed to format and display data, with focus on how data looks. Whereas XML was designed to store and transport data, not to display data. Therefore HTML is about displaying information, while XML is about carrying information.

XML tags are not predefined. We must define our own tags. XML is designed to be self-descriptive and is recommended by World Wide Web Consortium (W3C). XML is just plain text. Software that can handle plain text can also handle XML. However, XML-aware applications can handle the XML tags specially. The functional meaning of the tags depends on the nature of the application.

Features of XML :
  • XML is a markup language and its tags are user-defined.
  • XML is recommended by W3C and it is designed to be self-descriptive.
  • XML is not a replacement for HTML. Rather, it is a complement to HTML.
  • XML was designed to store and transport data, with focus on carrying information.

 

Basics of AJAX

AJAX, which stands for Asynchronous JavaScript and XML, is a group of inter-related web development techniques used on the client-side to create interactive web applications or Rich Internet Applications (RIAs). With Ajax, web applications can retrieve data from the server asynchronously in the background without interfering with the display and behavior of the existing page. The use of Ajax has led to an increase in interactive animation on web pages and better quality of web services due to the asynchronous mode. Data is usually retrieved using the XMLHttpRequest object. Despite the name, the use of JavaScript and XML is not actually required, nor do the requests need to be asynchronous.

In many cases, related pages on a website consist of much content that is common between them. Using traditional methods, that content would have to be reloaded on every request. However, using Ajax, a web application can request only the content that needs to be updated, thus drastically reducing bandwidth usage and load time. The use of asynchronous requests allows the client’s Web browser UI to be more interactive and to respond quickly to inputs, and sections of pages can also be reloaded individually. Users may perceive the application to be faster or more responsive, even if the application has not changed on the server side. The use of AJAX can reduce connections to the server, since scripts and style sheets only have to be requested once. State can be maintained throughout a web site. JavaScript variables will persist because the main container page need not be reloaded.

AJAX is based on the following web standards :
  • HTML
  • CSS
  • JavaScript
  • XML

The web standards used in AJAX are well-defined, and supported by all major browsers. AJAX applications are browser and platform independent.

Φ We start with XML here followed by AJAX.