Skip to main content

Search 436 pages — tools, formats, elements, namespaces, directory, comparisons, XPath, datatypes, glossary, parse errors, schema errors, use cases, guides, blog and product.

XML format

TEI document

The scholarly encoding standard for texts, where the markup records editorial judgement rather than presentation or structure alone.

TEI is how the humanities encode primary sources: manuscripts, correspondence, inscriptions, critical editions. What distinguishes it from every other document format here is that the markup carries editorial argument — <unclear>, <supplied>, <del>, <choice> with <sic> and <corr> — so the file records not only what the text says but what an editor decided it says, and on what evidence.

The consequence for anyone processing TEI is that you cannot flatten it to plain text without making an editorial choice of your own. A <choice> holding both the original reading and the correction has two valid renderings, and picking one silently is a scholarly claim.

Constraints that bite

  • The normative schema is RELAX NG, not XSD. TEI's own customisation system (ODD) generates it, and the generated schema is what a document validates against.
  • Every TEI document needs a <teiHeader>; a document without one is not TEI regardless of its body.
  • <choice> deliberately holds mutually exclusive readings. Flattening to text requires choosing, and the choice is an editorial act.
  • @xml:id values are the anchor for external annotation and must be stable across editions.
  • TEI is a family of customisations, not one vocabulary: a valid TEI Lite document may not validate against a project's own ODD.
Root element
<TEI>
Media type
application/tei+xml
Extensions
.xml, .tei
Namespaces
  • http://www.tei-c.org/ns/1.0
XMLDir label

Specification: TEI P5 Guidelines

A minimal valid document

Every example on this site is checked against the same parser the workspace uses, so what you see below is known to be well-formed.

tei.xml
<?xml version="1.0" encoding="UTF-8"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0">
  <teiHeader>
    <fileDesc>
      <titleStmt><title>Letter to Babbage</title></titleStmt>
      <publicationStmt><p>Example edition.</p></publicationStmt>
      <sourceDesc><p>MS. 42, fol. 3r.</p></sourceDesc>
    </fileDesc>
  </teiHeader>
  <text>
    <body>
      <p xml:id="p1">The engine <choice><sic>weaves</sic><corr>weave</corr></choice>
      algebraic patterns, as the <unclear reason="damage">Jacquard</unclear> loom
      weaves flowers.</p>
    </body>
  </text>
</TEI>

Get started

Bring order to the XML your team can't afford to ignore.

Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.