1. Home
  2. First Steps
  3. TEI-XML Tags
  4. What is a tag?

What is a tag?

A tag is a portion of text enclosed in angle brackets preceding the content node that it tags, and closed at the end of that node with the same tag preceded by a closing slash:

<note>Texto que es el nodo del contenido.</note>

Every tag must be closed at the end of its node, and modifies only the text contained between the opening and closing tags. There is no point in leaving blank spaces after the opening tag or before the closing tag, and it is better to completely avoid them.

When a tag contains one or more other tags (which is most of the time), the tags are always nested in hierarchical order. Always close a tag before closing its parent (immediately higher level) tag, like Russian dolls:

<div><p>Paragraph <foreign xml:lang="en">with a text in English</foreign> within a division.</p></div>

This can also be represented in the document with tabulations, to make the structure clearer:

	<p>Paragraph <foreign xml:lang="en">with a text in English</foreign> within a division.</p>

It does not matter if there are a lot of blank spaces between labels, or if they appear to be on different lines: these extra spaces are ignored when generating the final layout of the document and only one space will appear. If you do not want any spaces to appear between two labels, remove all spaces, tabs and line breaks between them.

It is useful to add one more indent tabulation to each tag that is nested within another, to visually check that the nesting is correct. For example, in the case of critical apparatus entries:

	<rdg wit="#L">lectura</rdg>

There are also tags that do not have a content node, so they appear only once and close themselves, but with the closing slash at the end of the tag. For example:

<gap />

<gap/> represents a lacuna in the text. The space before the closing slash is optional, but there cannot be more than one.

How can we help?