XML Syntax

Rule 1:


Root Element is the parent of all other nodes.


  <First child>
    <First sub child>.</First sub child>
    <Second sub child>.</Second sub child> </First child>

Rule 2:

XML Pro log:

XML prolog is optional. If XML exists then  XML must come first in the document.


<?xml version=”1.0″ encoding=”UTF-8?>

Rule 3:

Case Sensitivity:

XML tags are case sensitive.


<author> sameed </author>

<AUTHOR> sameed <AUTHOR>

In this example both tags representing different tags.

Rule 4:

Attributes values must be qouted.


Wrong Practice Right Practice
<book date=12/11/2007>
  <title>Book On XML</title>
<book date=12/11/2007>
  <title>Book On XML</title>

Rule 5:


Comment are used to give some opinion for better understanding.


< ! −− this is comment − − >

Rule 6:

Starting and closing of tags:

  • Every tag should have starting and ending.
  • For example <author> is the starting of author tag and </author> is the closing of the author tag.
  • Early starting tag should be late closed and late started tag should be early close. Example is shown in the diagram below.

tags in html


Fazal Rehman Shamil
Welcome to all friends. The reason for our success is only your love for T4Tutorials. Our team is always available to answer your queries regarding any kind of confusions or discussion regarding your study and career matters. For discussion with us please join our facebook group "T4Tutorials.com". The link of the group is mentioned below. Thanks and love to all for connecting with us. We are nothing without you. Love you all.....