XML Tags
XML Tags are the foundation of XML because they define the scope of an element in XML.
Furthermore, they can also be used to insert comments, declare settings needed for environment analysis, and to insert special instructions.
Classification
We can classify XML tags as follows:
Start Tag
Every non-empty XML element starts with a start-tag.
<name>
End Tag
Every element that has a start tag should end with an end tag.
</name>
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
<hr></hr>
or, a complete empty-element tag
<hr/>
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
<outer_element>
<internal_element>
This tag is closed before the outer_element
</internal_element>
</outer_element>