What is XML – eXtensive Markup Language ?

XML – eXtensive Markup Language

As the name suggests, XML is a markup language.XML allows you to create your own tags to describe the data between them. You’re not particularly interested in how the data will be presented.
Your main focus is ensuring that the data is well organized within descriptive tags (or elements). This is because XML is primarily used for data storage and transfer purposes – not for presentation purposes.


Benefits of XML

  • Easy data exchange – One of the good thing about XML is that it can allow easy sharing of data between different applications – even if these applications are written in different languages and reside on different platforms.
  • Self-describing data – When you look at an XML scripting, it is very easy to figure out the what content of data is transferred.
  • Create your own languages – XML allows you to specify your own markup language for your own specific purpose.



XML Viewers

You can see the XML content using any of the below  applications.

  • Notepad
  • Internet Explorer
  • Mozilla Firefox



XML Editors

An XML editor will make your life easier when coding XML, also it will help you to prevent from making errors.
The below are some XML editors can be used.

  • XML Notepad
  • XML Cooktop
  • XML Pro
  • XML Spy



XML Syntax

If you include an XML declaration, it must be the first item in your document. The below is the syntax for XML declaration.
<?xml version=”1.0″ encoding=”UTF-8″ standalone=”no”?>
Each XML document must have one root element. All other elements must be contained within the root element.
<root>
  <child>Test Data</child>
  <child>Test Data</child>
</root>


XML Elements

XML elements are represented by tags. Elements usually consist of an opening tag and a closing tag
Opening tags consist of <, followed by the element name, and ending with >.
Closing tags are the same but have a forward slash inserted between the less than symbol and the element name.
For Example:
<tag>Test Data</tag>
Note: All elements must close properly and all tags are case sensitive.
Things to remember:

  • Element names can contain any character
  • Element names must not contain spaces
  • Element names must not begin with a number or punctuation character Element names must not start with the letters xml



XML Attributes

XML elements can also contain attributes.
You use attributes within your elements to provide more information about the element. These are represented as name/value pairs.
For Example:
<tag attribute=”value”>Test Data</tag>


XML Entities

XML entities allow you to use text to refer to a data item, instead of using the data item itself.
Entity Syntax:
&gt;
The reason why we use entity in XML is, for example to represent 10>5. But system understand “>” is closing of tag, so to avoid this confusion we use entities.
Some of predefined entities

&lt; <
&gt; >
&amp; &
&quot;
&apos; &apos;