What is XML

XML stands for Extensible Markup Language and is a text-based markup language derived from Standard Generalized Markup Language (SGML).

XML tags identify the data and used to store and organize data, rather than specifying how to display it like HTML tags are used to display the data. XML is not going to replace HTML in the near but introduces new possibilities by adopting many successful features of HTML.

There are three important characteristics of XML that make it useful in a variety of systems and solutions:

  1. XML is extensible: XML essentially allows you to create your own language, or tags, that suits your application.

  2. XML separates data from presentation: XML allows you to store content with regard to how it will be presented.

  3. XML is a public standard: XML was developed by an organization called the World Wide Web Consortium (W3C) and available as an open standard.

XML Usage

A short list of XML’s usage says it all:

  • XML can work behind the scene to simplify the creation of HTML documents for large web sites.

  • XML can be used to exchange of information between organizations and systems.

  • XML can be used for offloading and reloading of databases.

  • XML can be used to store and arrange data in a way that is customizable for your needs.

  • XML can easily be mixed with stylesheets to create almost any output desired.

  • Virtually any type of data can be expressed as an XML document.

What is Markup?

XML is not itself a markup language rather it is a set of rules for building markup languages. So what exactly is a markup language? Markup is information added to a document that enhances its meaning in certain ways, in that it identifies the parts and how they relate to each other. More specificcally, a markup language is a set of symbols that can be placed in the text of a document to demarcate and label the parts of that document.

Following is an example of how XML markup looks when embedded in a piece of text:

   <text>Hello, word!</text>

This snippet includes the markup symbols , or you can call them tags and they are <message>…</message> and <text>… </text>. The tags <message> and </message> mark the start and end points of the whole XML fragment. The tags <text> and </text> surround the text Hello, world!.

Is XML a Programming Language?

A programming language is a vocabulary and syntax for instructing a computer to perform specific tasks. XML doesn’t qualify as a programming language because it doesn’t instruct a computer to do anything, as such. It’s usually stored in a simple text
file and is processed by special software that’s capable of interpreting XML.

Now we are going to learn about one of the most important part of XML, which is XML tags. XML tags form the base of an XML. They define the boundaries of an element in the XML. They can also be used to insert comments, declare settings for parsing the environment and insert special instructions.

We can categorize XML tags as follows:

Start Tag

The beginning of every non-empty XML element is marked by a start-tag. An example of start-tag is:


End Tag

Every element that has a start tag should end with using an end-tag. An example of end-tag is:


Note that the end tags include a solidus (“/”) before the element’s name.

Empty Tag

The text that appears between start-tag and end-tag is called content. An element which has no element is termed as empty. Now an empty element can be represented in two ways as below:

(1) Start-tag immediately followed by an end-tag as shown below:


(2) Its a complete empty-element tag as shown below:

<hr />

Empty-element tags may be used for any element which has no content.

XMl Tags Rules

Following are the rules that need to be followed for XML tags:

Rule 1

XML tags are case-sensitive. Following line of code is an example of wrong syntax </Address>, because of the case difference observed in the word “element” which is not allowed and gives error.

<address>This is wrong syntax</Address>

Following code shows is a correct way where we used the same case to name the start and end tag.

<address>This is correct syntax</address>

Rule 2

XML tags must be closed in order i.e XML tag opened inside another element must be closed before the outer element is closed. For example:

      This tag is closed before the outer_element

This entry was posted in   XML.
Bookmark the   permalink.

Admin has written 171 articles