XML Elements

By: Prof. Fazal Rehman Shamil
Last modified on May 27th, 2019

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.

Example:

<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
Latest posts by Prof. Fazal Rehman Shamil (see all)