XML – Extensible Markup Language

XML Stands for Extensible Markup Language. it is a mark up language like HTML and designed to describe data not display data.

XML is designed to describe data where as HTML is designed to display data. in XML, you can create your own tags.

XML is mainly used for data sharing and storage. XML is platform independent and is used for sharing information between different applications, programs and platforms.

XML documents form a tree structure with a root and elements.ALl elements can have sub elements.




  • In XML, all elements must have a closing tag
  • XML tags are case sensitive
  • Must have a root element
  • Few characters have special meaning in XML. That is called entity reference.
    • &lt; < less than
    • &gt; > greater than
    • &amp; & ampersand 
    • &apos; ‘ apostrophe
    • &quot; ” quotation mark
  •  The comments can be written similar to HTML
    • <!– this is a comment–>

 XML Elements:

Each and every tag defined within a XML message is XML elements.

  • Element names are case sensitive
  • Must start with a letter or underscore
  • Can’t start with XML keyword
  • Can’t contain space
  • Can contain letter,number, underscores and hyphens

XML elements are extensible and can be extended to carry more info. like subelements.

 XML elements can have attributes and attributes provide more information on element.

  • XML attributes can’t contain multiple values
  • XML attributes are not expandable
  • XML attribute does not contain a root


&lt;customer gender="female"&gt;

&lt;customer &gt;

In 1st Example, gender is an attribute and in 2nd example, gender is an element.

XML namespace helps to avoid element name conflicts.

XML Schema:

XML schema defines the structure of XML document.

  • XML Schemas are written in XML
  • XML Schemas are extensible
  • XML Schemas support data types and namespaces

&lt;xs:element name="customer"&gt;
    &lt;xs:element name="name" type="xs:string"/&gt;
    &lt;xs:element name="address" type="xs:string"/&gt;
    &lt;xs:element name="zip" type="xs:string"/&gt;
    &lt;xs:element name="phone" type="xs:string"/&gt;

In above example:

<xs:element name=”customer”> defines the element called “customer”
<xs:complexType> the “customer” element is a complex type
<xs:sequence> the complex type is a sequence of elements
<xs:element name=”name” type=”xs:string”> the element “name” is of type string (text)
<xs:element name=”address” type=”xs:string”> the element “address” is of type string
<xs:element name=”zip” type=”xs:string”> the element “zip” is of type string
<xs:element name=”phone” type=”xs:string”> the element “phone” is of type string



© 2015, www.techkatak.com. All rights reserved.