.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Articles >> XML >> Post New Resource Bookmark and Share   

 Subscribe to Articles

An Introduction to basic advantage of XML

Posted By:Ravi Ranjan Kumar       Posted Date: November 30, 2011    Points: 200    Category: XML    URL: http://www.dotnetspark.com  

This article enable you to learn about basics advantage of XML

Some of the advantage of XML are : 

1) Domain-specific vocabulary 
2) Data interchange 
3) Smart searches
4) Granular updates
5) User-selected view of data
6) Message transformation

1) Domain-Specific Vocabulary :- 

HTML uses a set of predefined tag to present data in various formats. While working with HTML, you are restricted to the use of only these tags. On the other hand, XML does not have andy predefined tag. You can create new tags based on the requirement of the application, that is you cn create domain-specific vocabulary in XML.33
Consider the following HTML code snippet :- 

My Book

John Smith
Tech Books Publlications
$ 30.00

The preceding code snippet represents about the author, publisher and cost of a book, however the tag used for presenting this content do not reveal this information. The tags specify the format in with the content must be displayed on a browser. The same information can be represented in XML as :

  My Book
  John Smith
  Tech Publications

In the preceding code snippet, the content is described by using meaningful tags to represent the data. XML  enables you to create a markup  languages for your applications and does not place any restriction on he number of tags that you can define. There are several languages derived from XML such as MathML, which is a markup languages used for the representation of mathematical formulae and scientific data, and Wireless Markup Languages(WML), which is used for Web application that can be accessed by using a cellular phone.

2) Data Interchange :

Data Interchange is essential to carry out business transaction. You need to establish standards interfaces among related enterprises in which the data is stored in disparate forms to facilities data interchange. XML produces files that are unambiguous, easy to generate and easy to read. It provides a structure to store data in textual format, which can then be used as a standard format or protocol for data interchange. This eliminates the differences in the system that exchange data.

3)Smart searches :- 
Although HTML provides you with a set of predefined tags, it difficult to implement a search on an HTML document. For Example Consider the following code snippet in HTML :-

The best picture award in 1999 went to the form  Titanic  This film was based on the story of a ship called  Titanic 
In the preceding code snippet, the search engine will not be able to determine whether you are referring to Titanic as a ship, a play, or a film. If you specify a search for the text Titanic within the tags tags.

The flexibility to create user-defined tags in XML enables you to create smart searches engines. For examples, consider the following code snippet :

The best picture award in 1999 went to the film
this Film was based on the story of a ship called 

In the preceding code snippet, it is very clear that Titanic is a references to a film by that name. when you perform a search, you can specify that the search needs to be performed for the text Titanic within the and tags. This enables the browser to perform search and return    precise information that matches the searches query.

4) Granular Updates :- 

Document updates in HTML are slowly as the entire document needs to be refreshed from the server. In comparison wih this, only the changed needs to be downloaded in XML document, thus making updates faster. For example if you need to updates stock prices on a web page, it will take more time to updates an HTML document as the entire page would to be reloaded. With XML, only the price can be updated.

5)User Selected View of Data 

In HTML, you need to create separate HTML page to display the same information in different formats. This is because an HTML page contains data as well as, instructions to the browser for the presentation of data. On the other hand, XML concentrates on the data and not on its presentation. You can displays XML documents in the required format by using Cascading Style Sheets (CSS) and Extensible Style Sheet Languages(XSL). This separation of data from its presentation has various advantages. For examples, you can downloaded an XML document once and apply different formatting styles by using CSS or XSL.

A user can select one, Several or all records and sort by different attributes, format data based on a condition, or switch to the graphical view without requesting the XML document from the server for each operation.
HTML does not allow conditional formatting of a document. For Example :- its is not possible using HTML to display the name of the product with the highest sales figures in green and the lowest sales figure in red. You can implement conditional formatting of data by using XML. 

6) Message Transformation:- 
In XML, a message cat be stored in the format of a document, object data, or data form a database. XML message are designed in such a way that they reflect the information content and not the intended use of the messages. XML design provides flexibility while content and not the intended use of the message. XML design provides flexibility while storing data as it does not imposes any restriction on the field size and the order in which the data is stored. Data can be extracted based on the needs of the client application. 

 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend