XML - Tag

> Markup Language (ML) > Extensible Markup Language (XML)

1 - About

Text inside


are called tags.

Tags nearly always come in pairs:

or are:

Tags also nest. You should close them in the right order: the most recently opened tag should be the first one closed.

When there is content between the tags, the entire structure is called an element and the text between the start-tag and end-tag is called the element's content


3 - Property

3.1 - Name


  • are case-sensitive
  • must start with a letter or underscore
  • cannot start with the letters xml(or XML, or Xml, etc)
  • can contain letters, digits, hyphens, underscores, and periods
  • cannot contain spaces

4 - Type

4.1 - Start

The beginning of every non-empty XML element is marked by a start-tag.

An example of a start-tag:

<termdef id="dt-dog" term="dog">

4.2 - End

The end of every element that begins with a start tag MUST be marked by an end-tag containing a name that echoes the element's type as given in the start-tag.

An example of an end-tag:


4.3 - Empty

An Empty-element tag is also known as self-close. Note the / in the tag to close it.

It may be used to describe any element which has no content,

Examples of empty elements tag:

<IMG align="left" src="http://www.w3.org/Icons/WWW/w3c_home" />

5 - Documentation / Reference