Skip to main content

XML Tags

XML Tags are the foundation of XML because they define the scope of an element in XML.

Furtheremore, they can also be used to insert comments, declare settings needed for environment analysis, and to insert special instructions.


We can classify XML tags as follows:

Start Tag

Every non-empty XML element starts with a start-tag.


End Tag

Every element that has a start tag should end with an end tag.


The end tag includes a / before the name of the element!

Empty Tag

The text that appears between start-tag and end-tag is called content.

An element which has no content is called empty.

An empty element can be represented in two ways:

A start-tag immediately followed by an end-tag


or, a complete empty-element tag


Empty-element tags (showed in the second example) can be used for any element which has no content.

XML Tags Rules

Each XML tag must adhere to the following rules:

Rule 1: XML tags are case-sensitive

A wrong example:

<name>Tom Nolan</Name>

<name> and <Name> are two different tags!

A correct example:

<name>Tom Nolan</name>

Rule 2: XML Tags order must be respected

An XML tag opened inside another element must be closed before the outer element is closed

This tag is closed before the outer_element