Skip to main content

TEI 101

TEI, or the Text Encoding Initiative, is both a set of guidelines for the digital annotation of texts and the consortium that publishes the guidelines. When someone refers to TEI, they quite often are not referencing the body of academics who develop the guidelines, but rather the standards maintained by the TEI Guidelines. TEI is not a markup language itself, but recommendations for the markup of texts in terms of the Extensible Markup Language (XML). For more on XML, see the XML page.

In discussions of TEI, the terms “markup”, “encoding”, and “tagging” are used relatively interchangeably to refer to the means of specifying the structure and interpretation of a text. A “tag” informally refers to the XML code that surrounds text. These tags can be structural or semantic. For example, TEI uses the <p> tag to denote a paragraph, and the <persName> tag to denote the occurrence of a person within the text.

Elements

Tags themselves are also known as elements. The TEI Guidelines provide rules for where certain elements can be used, as well as how they are meant to be used. For example, a <p> paragraph element cannot contain another <p> paragraph element, but can contain <span>, a tag that “associates an interpretive annotation directly with a span of text”.

Attributes

Besides elements, in discussions of TEI you will also hear about attributes. If an element denotes a portion of text as being a thing, an attribute describes the element beyond its set definition. For example, the element <placeName> identifies a piece of text as the name of a person (such as <placeName>Italy</placeName>). An attribute can be added within the tag to specify details about the place name. For example, @xml:lang is an attribute specifying the language contained in an element. This would manifest as <placeName xml:lang=”en”>Italy</placeName>, explaining that Italy is the English name for the place, as opposed to <placeName xml:lang=”fr”>Italie</placeName>, the French name.

TEI attributes can also be used for the creation of Linked Open Data. In TEI, this is often done by the use of the @ref attribute, which provides a link to an authority database. With our previous example, this would appear as <placeName xml:lang=”en” ref=”https://www.wikidata.org/wiki/Q38”>Italy</placeName>.

TEI Header

Another feature of the TEI guidelines is the TEI header, which stores the metadata for your document. For more on the TEI header, see the Header page in the TEI guidelines.

The TEI guidelines are very expansive, and should serve as guidance and recommendation rather than rigid rules. If you are just starting out with TEI, take your time exploring the guidelines and experimenting with what information you can capture. Good luck, and reach out if you have any questions!