Varieties of textual structure
Texte intégral
1In the TEI view, texts and their divisions may contain a fairly limited range of ‘structural’ components. These include such things as the headings or preliminary matter at the start or end of a division, and a number of basic building blocks which are characteristic of prose, verse, or drama. Prose, for the most part, consists of paragraphs or lists, marked using the elements <p> or <list> respectively. Verse consists of verse lines, marked using the <l> element, or sequences of verse lines marked using the <lg> (line group) element. In drama, an additional building block is provided in the form of the <sp> (speech) element, which combines a <speaker> element with one or more <p> or <l> elements depending on whether the drama is in verse or prose.
A journal article
2The body of an academic article, for example, might be encoded with a structure like the following:
<body xml:lang="en">
<div type="section">
<head>Introduction</head>
<p>We recommend the use of TEI markup as a
means of representing scientific prose. It has a
number of practical advantages: </p>
<list>
<item>TEI markup is easy to add;</item>
<item>TEI markup is widely understood;</item>
<item>TEI markup is easy to convert to other formats.</item>
</list>
<p>TEI markup also has some scientific
advantages, which we discuss in section <ptr target="#SEC3"/>.</p>
<!-- further introductory paragraphs here -->
</div>
<div type="section">
<head>Origins of the TEI</head>
<p>The Text Encoding Initiative was born in 1987 .... </p>
<!-- many more paragraphs here -->
</div>
<div xml:id="SEC3">
<head>Scientific properties of TEI markup</head>
<p>TEI markup expresses a view of the nature of text ... </p>
<!-- many more paragraphs here -->
</div>
</body>
3Note that this markup indicates only the organization of the document. It says nothing about how it should be visualised on screen or on paper. It indicates that there are sections which have titles, and which contain paragraphs and lists. It distinguishes the items in the list, but it does not specify whether they should be prefixed with a bullet or a dash or a number. The <ptr> element indicates the existence of a cross reference from one part of the document (the location of the <ptr > element) to another (the <div> element entitled Scientific properties...). The value of the @target attribute introduced above specifies the target of the cross reference, but it does not specify whether this should be realised as (say) an HTML link, or some added text (such as the section number) or both. Of course, it is not hard to imagine how we might display these document components using a formatting language such as Word, HTML, or LaTex but that is not the primary purpose of this markup. Because these aspects are all left unspecified in the encoding, the same document can be re-used in different processing contexts.
A poetic text
4Our second example shows a famous Shakespearian sonnet, transcribed from a specific print copy:
<lg type="sonnet">
<head>130</head>
<l>My Mistres eyes are nothing like the Sunne,</l>
<l>Currall is farre more red, then her lips red,</l>
<l>If snow be white why then her brests are dun:</l>
<l>If haires be wiers, black wiers grow on her head:</l>
<l>I have seene Roses damaskt, red and white,</l>
<l>But no such Roses see I in her cheekes,</l>
<l>And in some perfumes is there more delight,</l>
<l>Then in the breath that from my Mistres reekes.</l>
<l>I loue to heare her speake, yet well I know.</l>
<l>That Musicke hath a farre more pleasing sound:</l>
<l>I graunt I never saw a goddesse goe,</l>
<l>My Mistress when she walkes treads on the ground.</l>
<lg type="couplet">
<l>And yet by heaven I thinke my love as rare,</l>
<l>As any she beli'd with false compare.</l>
</lg>
</lg>
5Again, this markup captures only the structure of the sonnet: indicating the individual verse lines of which it is composed, and marking explicitly the couplet at its end. Because individual lines are distinguished in the encoding, rather than being treated as if they were paragraphs, or accidents of formatting, a metrical analysis of the poem can automatically be generated.
6 Comparing it with the following digital image of the original source we can see that although the original spelling has been retained, this encoding has chosen to ignore such layout features as the use of dropped caps or the indentation associated with the couplet. It has retained the original spelling, but silently modernised some of the typographic variation, such as the long S, or the ligatured letters.
Figure 1

7 We will see below how this encoding could be enhanced to produce an acceptable modern reading version as well as the quasi-diplomatic version shown here.
A play text
8Our third example shows how we might encode the structure of a dramatic text: in this case, the end of Beckett’s Waiting for Godot.
<div type="scene">
<!-- ... -->
<sp>
<speaker>Vladimir</speaker>
<p>Pull on your trousers.</p>
</sp>
<sp>
<speaker>Estragon</speaker>
<p>You want me to pull off my trousers?</p>
</sp>
<sp>
<speaker>Vladimir</speaker>
<p>Pull <emph>on</emph> your trousers.</p>
</sp>
<sp>
<speaker>Estragon</speaker>
<p>
<stage>(realizing his trousers are down)</stage>.
True</p>
</sp>
<stage>He pulls up his trousers</stage>
<sp>
<speaker>Vladimir</speaker>
<p>Well? Shall we go?</p>
</sp>
<sp>
<speaker>Estragon</speaker>
<p>Yes, let's go.</p>
</sp>
<stage>They do not move.</stage>
</div>
9In this encoding, we have introduced a few more TEI elements, to enable us to distinguish the stage directions (<stage>) from the individual speeches of the characters (<sp>). Note that a stage direction can appear both within and between speeches and that a speech always contains both an identifying label to show who is speaking (<speaker>) and a paragraph (<p>) to contain what they say. In a verse drama, of course, the speeches would probably contain a sequence of <l> elements.
A postcard
10The TEI is widely used for existing literary or formally published works. However it can also be used for entirely different kinds of document, such as authorial manuscripts, archival papers, or any other kind of informal writing. Our fourth example shows how we might use the TEI to encode the structure of this postcard:
Figure 2

11All postcards have two sides, a recto and a verso: we represent these as <div> elements. Within the side shown above, we can see that there is a clear distinction between the part carrying the message, to the left, and the part relating to the sending of the card, containing various stamps and an address. Here is one possible encoding, which uses the same <div> and <p> elements we have already seen, together with some additional more specialised elements and attributes:
<div type="verso">
<div type="message">
<p>You should try this place. You can see how
genteel it is</p>
<p> Hope you enjoyed Wales, as they
said to Mrs Fitzherbert</p>
<signed>Mama</signed>
</div>
<div type="destination">
<ab>
<stamp type="publicity">Silhouette of
vintage car and slogan <mentioned>Brighton
& Hove all set for the seventies.</mentioned>
</stamp>
<stamp type="postmark">Circular mark
specifying <mentioned>Brighton &
Hove - Sussex</mentioned> and <date
when="1970-10-26">26 Oct 1970</date>
</stamp>
<stamp type="postage"> Machin design. 4d,
vermillion. </stamp>
</ab>
<address>
<addrLine>Mr Louis Burnard</addrLine>
<addrLine>4 Freeland Cottages,</addrLine>
<addrLine>Stanton St John</addrLine>
<addrLine>OXFORD</addrLine>
</address>
</div>
</div>
12The <signed> element used to enclose the signature block is one of several specialised elements provided by the TEI for material such as signatures or headings which can appear at the beginning or end of a <div> . It seems useful to distinguish it from the rest of the message, since other such signing off phrases or formules de politesse contain a different, more formal, kind of language from the rest.
13In the other division, we have distinguished three different kinds of stamp: the postage stamp itself, the postmark indicating when and where the card was posted, and an additional publicity stamp promoting the Brighton and Hove Vintage Car Rally. The TEI <stamp> element is intended to contain descriptive text about any kind of stamp; where our description includes words actually appearing as part of the stamp we use the TEI <mentioned> element. In the case of the postmark, we have also distinguished the date given. Much of our research on an archive of such encodings will want to search and group cards reliably by the date on which they were posted. Dates as given in postmarks often use different formats and may be incomplete: we therefore add to the encoded date a normalised value, supplied on the @when attribute. Finally, we have given the address to which the card was sent, simply dividing it up into lines.
14In a more detailed encoding we would probably distinguish the names of people and places, perhaps adding geographic co-ordinate information for the place names mentioned. We might wish to add some explanation of the little joke about Wales. We would probably want to distinguish the formulaic parts of the message, such as its opening and closing lines, from the content. And we would also consider how best to record the textual information printed on the back of the card - the title and the name of its publisher for example. The scope of such metadata, which provides useful information about how the card was produced and used is very large and it is hard sometimes to know where to stop. For example, the yellow stain visible on the image suggests that this card was once attached to something by means of cheap adhesive tape. If this were a very rare historical artefact such evidence of provenance might be of considerable importance and would need to be encoded using (for example) the <damage> element.
A minimally structured text
15Finally, if this all seems too much, we should note that the TEI can also support a very simple structural view in which all these conventional, semantically-charged, components such as paragraphs, speakers, verse lines, etc. are elided or ignored in favour of a neutral segmentation based on orthographically-defined sentences. In such a view, we might decide to keep the main divisions of the text, but then simply split it up into linguistically convenient segments at every appropriate punctuation mark, using the generic <s> (segment) and <ab> (anonymous block) elements. To reprise our first example:
<body xml:lang="en">
<div type="section">
<ab>
<s n="1">Introduction</s>
<s n="2">We recommend the use of TEI markup
as a means of representing scientific
prose.</s>
<s n="3">It has a number of practical advantages:</s>
<s n="4">TEI markup is easy to add;</s>
<s n="5">TEI markup is widely understood;</s>
<s n="6">TEI markup is easy to convert to other formats.</s>
<s n="7">TEI markup also has some scientific
advantages, which we discuss in
section <ptr target="#SEC3"/>.</s>
lt;/ab>
</div>
</body>
16Although such markup obviously lacks information present in the richer version we presented before, and is thus less generally useful, its simplicity and regularity means that it is much easier to process for such comparatively mechanical tasks as vocabulary analysis or linguistic enrichment. As ever, to get the best out of the TEI requires us to think carefully about our priorities before making our encoding decisions.
Composites
17A TEI text may be simple (for example, a single book) or composite (for example a collection or anthology). In either case the main body of the text may be preceded or followed by additional distinct matter (title pages, prefaces, dedications, indexes etc.). The TEI proposes a mandatory element <body> for the main part of a text, and optional elements <front> and <back> to group additional matter preceding or following the body respectively. In a composite text, the ‘body’ of the text is represented by a group element, which can contain multiple <text> elements, or groups of them, as in the following schematic:
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<teiHeader>
<!--[ header of a composite text ]-->
</teiHeader>
<text>
<front>
<!--[ front matter for the composite text ]-->
</front>
<group>
<text>
<front>
<!--[ front matter for the first text in the composite ]-->
</front>
<body>
<!--[ body of the first text in the composite ]-->
</body>
<back>
<!--[ back matter for the first text in the composite ]-->
</back>
</text>
<text>
<front>
<!--[ front matter for the second text in the composite ]-->
</front>
<body>
<!--[ body of the second text in the composite ]-->
</body>
<back>
<!--[ back matter for the second text in the composite ]-->
</back>
</text>
<!--[ more texts, simple or composite ]-->
</group>
<back>
<!--[ back matter of the composite text ]-->
</back>
</text>
</TEI>
18A structure like this would be appropriate for encoding a pre-existing anthology of verse by many authors but a single editor.
19In this model there is just one TEI Header for the whole of the composite text. The TEI also allows for a composite which represents a collection of documents originally distinct but put together by the encoder for some purpose: language corpora are typical examples. Each constituent document in a language corpus has its own metadata, represented by its own <teiHeader> , but there is an additional layer of metadata relating to the corpus as a whole. This is encoded in TEI using a structure like the following:
<teiCorpus xmlns="http://www.tei-c.org/ns/1.0">
<teiHeader>
<!--[metadata relating to the whole corpus]-->
</teiHeader>
<TEI>
<teiHeader>
<!--[metadata relating to the first text in the corpus]-->
</teiHeader>
<text>
<!--[first text in the corpus]-->
</text>
</TEI>
<TEI>
<teiHeader>
<!--[metadata relating to the second text in the corpus]-->
</teiHeader>
<text>
<!--[second text in the corpus]-->
</text>
</TEI>
</teiCorpus>
20A structure like this would be appropriate for encoding a newly-constructed collection of postcards or other independent textual objects.

Le texte seul est utilisable sous licence Creative Commons - Attribution - Pas d'Utilisation Commerciale - Pas de Modification 4.0 International - CC BY-NC-ND 4.0. Les autres éléments (illustrations, fichiers annexes importés) sont « Tous droits réservés », sauf mention contraire.
What is the Text Encoding Initiative?
How to add intelligent markup to digital resources
Lou Burnard
2014
What is digital identity?
Issues, tools, methodologies
Olivier Ertzscheid Helen Tomlinson (trad.)
2016
Sur quoi reposent nos infrastructures numériques ?
Le travail invisible des faiseurs du web
Nadia Eghbal
2017
Qu’est-ce qu’un forum internet ?
Une généalogie historique au prisme des cultures savantes numériques
Camille Paloque-Bergès
2018
Qu’est-ce qu’une archive du web ?
Francesca Musiani, Camille Paloque-Bergès, Valérie Schafer et al.
2019
Qu’est-ce que le travail scientifique des données ?
Big data, little data, no data
Christine L. Borgman Charlotte Matoussowsky (trad.)
2020
Qu’est-ce que la cartographie du web ?
Expéditions scientifiques dans l’univers des données numériques et des réseaux
Franck Ghitalla Dominique Boullier et Mathieu Jacomy (éd.)
2021