Advantages of XML

Using XML to exchange information offers many benefits.

Advantages of XML include the following:

  • XML uses human, not computer, language. XML is readable and understandable, even by novices, and no more difficult to code than HTML.
  • XML is completely compatible with Java™ and 100% portable. Any application that can process XML can use your information, regardless of platform.
  • XML is extendable. Create your own tags, or use tags created by others, that use the natural language of your domain, that have the attributes you need, and that makes sense to you and your users.

The following example illustrates, in a simplified way, the readability and extensibility of XML:

HTML example XML example
<H1 ID="MN">State</H1>
<H2 ID="12">City</H2>
<H2 ID="15">City</H2>
<H2 ID="20">City</H2>
    <DD>Lake Bell</DD>

  <CITY CITYID="12">
  <CITY CITYID="15">
  <CITY CITYID="20">
    <NAME>Lake Bell</NAME>

HTML tag names reveal nothing about the meaning of their content. The example above uses an HTML definition list, but the problems inherent in using HTML occur if the data were contained in a table or some other kind of HTML tags. Examples follow:

  • Many of the HTML tags are acronyms, so they are not as readable as common language.
  • HTML tags represent data (in this example, city names and populations) as items to display, for example, as definitions in a list or cells in a table. This makes it difficult to manipulate the data or to exchange it between applications.

The XML tag names are readable and convey the meaning of the data. The information structure is easily discerned by both humans and computers as each XML tag immediately precedes the associated data. The data structure follows a noticeable and useful pattern, making it easy to manipulate and exchange the data.