Code Example 0: XML markup
<person>John Adams</person>
<person type="president">John Adams</person>
(The above marks this as a specific classification of "John Adams" with the use of an XML "attribute").
But we can get more fine-grained than this by encoding the forename and surname separately.
<person type="president"><forename>John</forename> <surname>Adams</surname><person>
Code Example 1:
<person>
<firstName>Abraham</firstName>
<lastName>Lincoln</lastName>
</person>
Code Example 2:
<person type="olympian">
<firstName>Oscar</firstName>
<lastName>Pistorius</lastName>
</person>
Code Example 3:
<article>
<title>Tragic Events in South Africa</title>
<author>
<lastName>Rivera</lastName>,
<firstName>Geraldo</firstName
<middleName>M.</middleName
</author>
<date>February 19, 2013</date>
<paragraph>
<sentence>It was a dark and stormy night.</sentence>
<sentence>Oscar Pistorius thought an intruder was in the house.</sentence>
<sentence>He pulled out his 9mm pistol, moved toward the bathroom and fired into the door.</sentence>
</paragraph>
</article>
Code Example 4:
<persName>
<surname>Pistorius</surName>,
<forename>Oscar</forename>
<persName>
Note: There are two errors in this code, a tag mismatch and a missing slash. Can you find them?
EXERCISE 1:
1. Copy the following line into computer memory:
<div><p>My name is <persName><forename>___</forename> <surname>___</surname></persName></p></div>
2. Go to TBE validation service - checks your TEI encoding for errors
3. Replace "___" with your first name and last name
4. Add <forename>[your middle initial]</forename>
5. Keep the "TBE validation service" tab open and go back to the Exercises page.
Code Example 5: Basic Structure of a TEI Document
<TEI>
<teiHeader>
<!--- Insert bibliographic information about the text. -->
</teiHeader>
<text>
<!-- Insert the poem itself here. -->
</text>
</TEI>
EXERCISE 2:
1. Go back to the open "TBE validation service." (TBE validation service)
2. Click "Copy to Input."
3. Type in something for the title header <title> and <publisher>
<title>My first TEI project</title>
<publisher>Hamilton College</publisher>
Source of poem: http://www.poetryfoundation.org/poem/172051
Code Example 6: TEI markup of teiHeader of "Ghazal"
<?xml version="1.0" encoding="UTF-8"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0" xml:lang="en">
<teiHeader>
<fileDesc>
<titleStmt>
<title>Ghazal: a machine-readable transcription</title>
<respStmt>
<resp>poet</resp>
<name>Agha Shahid Ali</name>
</respStmt>
<respStmt>
<resp>editor</resp>
<name>Peter J. MacDonald</name>
</respStmt>
</titleStmt>
<publicationStmt>
<publisher>Hamilton College</publisher>
<pubPlace>Clinton, New York</pubPlace>
<date when="2013"/>
</publicationStmt>
<sourceDesc>
<p>"Ghazal," by Agha Shahid Ali, originally published in "Rooms Are Never Finished," Copyright ©
2002 by Agha Shahid Ali</p>
</sourceDesc>
</fileDesc>
</teiHeader>
Code Example 7. Marking up the Text Layout of a Poem (stanzas, line, fonts, underlining, indenting):
<lg>
<l>I'll do what I must if I'm bold in real time.</l>
<l>A refugee, I'll be paroled in real time.</l>
</lg>
<lg>
<l>Cool evidence clawed off like shirts of hell-fire?</l>
<l>A former existence untold in real time ... </l>
</lg>
<lg>
<l>The one you would choose: Were you led then by him?</l>
<l>What longing, O <hi rend="italic">Yaar</hi>, is controlled in real time?</l>
</lg>
<lg> = line group
<l> = line
<lb = line break
<hi rend="italic"> = render the text with italic font
Code Example 8: Marking up the Poetic Form of a Poem (rhyme, meter):
<lg type="poem">
<lg type="couplet" n="1">
<l n="1">I'll do what I must if I'm <rhyme label="a">bold</rhyme> <rhyme label="b" xml:id="A">in real time</rhyme>.</l>
<l n="2">A refugee, I'll be <rhyme label="a">paroled</rhyme> <rhyme label="b" corresp="#A">in real time</rhyme>.</l>
</lg>
<lb/>
<lg type="couplet" n="2">
<l n="3">Cool evidence clawed off like shirts of hell-fire?</l>
<l n="4">A former existence untold <rhyme label="a" corresp="#A">in real time</rhyme> ... </l>
</lg>
<lb/>
<lg type="couplet" n="3">
<l n="5">The one you would choose: Were you led then by him?</l>
<l n="6">What longing, O <hi rend="italic">Yaar</hi>, is controlled <rhyme label="a" corresp="#A">in real time</rhyme>?</l>
</lg>
</lg>
<x @type=""> = type of x
<x @n=""> = unique number assigned to this x
<rhyme> = rhyme scheme: a, b, etc.
<x @xml:id="n"> = unique number representing this content
<x @corresp="#Y"> = content corresponds to another item had @xml:id:Y
Code Example 9: Mark up the Semantics.
<interpGrp resp="PMacD" type="imagery">
<interp xml:id="uncertainty">uncertainty unknown hidden</interp>
<interp xml:id="assertivenes">assertiveness action</interp>
<interp xml:id="hope">desire hope longing</interp>
<interp xml:id="salvation">salvation safety renewal</interp>
<interp xml:id="temporalDislocation">dislocation, distancing, tempral
remoteness</interp>
<interp xml:id="spatialDislocation">home, geographic terminology</interp>
<interp xml:id="socialDislocation">social dislocation, stranger, strangeness,
foreigness</interp>
<interp xml:id="nostalgia">nostalgia, memory, remembering</interp>
<interp xml:id="victimization">victimization</interp>
<interp xml:id="adversity">adversity, danger, opposition, challenges</interp>
</interpGrp>
<lg type="ghazal">
<lg type="couplet" n="1">
<l n="1">
<seg ana="#assertiveness">I'll do what I must</seg>
<seg ana="#uncertainty">if I'm bold</seg>
<seg ana="#temporalDislocation">in real time</seg>.</l>
<l n="2">A <seg ana="#socialDislocation">refugee</seg>,
<seg ana="#salvation">I'll be paroled</seg>
<seg ana="#dislocation">in real time</seg>.</l>
</lg>
<lb/>
<lg type="couplet" n="2">
<l n="3"><seg ana="#adversity">Cool evidence clawed off like shirts of hell-fire?</seg></l>
<l n="4">A <seg ana="#temporalDislocation">former existence</seg>
<seg ana="#uncertainty">untold</seg>
<seg ana="#temporalDislocation">in real time</seg> ... </l>
</lg>
<lb/>
<lg type="couplet" n="3">
<l n="5">The one you <seg ana="#modality">would</seg>
<seg ana="#assertiveness">choose</seg>:
<seg ana="#uncertainty">Were you led then by him?</seg></l>
<l n="6">What <seg ana="#hope">longing</seg>, O <foreign><hi rend="italic">Yaar</hi></foreign>, is controlled
<seg ana="#temporalDislocation">in real time</seg>?</l>
</lg>
</lg>
EXERCISE 3:
1. Copy the following entire poem into computer memory:
2. Go to the TEImatron.
3. Paste in the poem.
4. Click "Submit."
TEI gives us a standard vocabulary to make explicit the form and meaning of a poem so computers can process it.
Learning TEI Encoding
Processing Engines for TEI files
Hamilton College Library TEI Projects
TEI Projects with Dynamic Output
TEI Project under development
- Top -
(Reviewed: February 27, 2013)