XML Elements

What are XML elements?

An XML element is everything from the XML element’s starting tag to the XML element’s ending tag.

An element can contain:

  • Starting tag
  • Attributes
  • Text
  • Closing tag
  • other elements
  • or a combination of all things mentioned above.


<author category=”literature”> sameed </author>

In this example;

<author> is the starting tag

sameed is the text

Category is the attribute/property

Literature is the value of the attribute.

</author> is the closing of the tag.

XML Naming Rules:

  • Element name is case-sensitive:
  • Element name must start with a underscore or alphabets.
  • Element name cannot start with the letters XML/xML/xml/Xml, etc.
  • Element name cannot contain spaces
  • Element name can contain digits,  letter, hyphens, periods and underscore. 
  • Element name can have any name except xml.



Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,
2. Video lectures on Youtube
3. Email is only for Advertisement/business enquiries.