Module 4: Poetry

4. William Shakespeare: “Sonnet 17”

The following example illustrates a very elaborate text encoding of a sonnet by William Shakespeare. As most sonnets, this poem is structurally analysed in three quatrains and one couplet. The lines themselves are further divided in metrical feet (<seg type="foot">) whose metrical analysis is provided in the @met of their containing <lg> element. For feet that metrically diverge from the metrical system, the actual metrical realisation is given in a <real> attribute. Where a foot runs over several syntactic phrases, the boundary between these phrases is marked with a <caesura> element. The rhyme scheme is encoded in the @rhyme attribute at the stanza level. In the example, the relevant <teiHeader> fragment is included for clarity’s sake.

<TEI xmlns="">
<metDecl pattern="((+|​-)+\|?/?)*">
<metSym value="trochee" terminal="false">+-</metSym>
<metSym value="iamb" terminal="false">-+</metSym>
<metSym value="spondee" terminal="false">++</metSym>
<metSym value="pyrrhic" terminal="false">--</metSym>
<metSym value="amphibrach" terminal="false">-+-</metSym>
<metSym value="anapaest" terminal="false">--+</metSym>
<metSym value="+">metrical promimence</metSym>
<metSym value="-">metrical non​-prominence</metSym>
<metSym value="|">foot boundary</metSym>
<metSym value="/">metrical line boundary</metSym>
<p>Metrically prominent syllables are marked '+' and other syllables '-'. Foot divisions are marked by a vertical bar, and line divisions with a solidus.</p>
<p>This notation may be applied to any metrical unit, of any size (including, for example, individual feet as well as groups of lines).</p>
<p>The 'real' attribute has been used to indicate possible variations in the iambic base metre. Where this attribute is not included, it is assumed each foot inherits the iambic metre defined for the overall division of text.</p>
<p>The 'met' attribute has been used in feet which have a missing or additional syllable rather than the two syllables expected, although the line may still confirm to the metre of the poem.</p>
<lg type="poem" met="-+ | -+ | -+ | -+ | -+ /">
<title>Sonnet 17</title>
<lg type="sonnet" rhyme="abab cdcd efef gg">
<lg type="quatrain">
<seg type="foot" real="+-"> Who will</seg>
<seg type="foot"> believe</seg>
<seg type="foot"> my verse</seg>
<seg type="foot"> in time</seg>
<seg type="foot"> to come,</seg>
<seg type="foot">If it</seg>
<seg type="foot"> were fill​'d</seg>
<seg type="foot"> with your</seg>
<seg type="foot"> most high</seg>
<seg type="foot" real="+-"> deserts?</seg>
<seg type="foot">Though yet,</seg>
<seg type="foot" real="+-"> heaven knows,</seg>
<seg type="foot"> it is</seg>
<seg type="foot"> but as</seg>
<seg type="foot"> a tomb</seg>
<seg type="foot">Which hides</seg>
<seg type="foot"> your life </seg>
<seg type="foot">and shows</seg>
<seg type="foot"> not half</seg>
<seg type="foot"> your parts. </seg>
<lg type="quatrain">
<l enjamb="y">
<seg type="foot">If I</seg>
<seg type="foot"> could write</seg>
<seg type="foot"> the beau</seg>
<seg type="foot">ty of </seg>
<seg type="foot"> your eyes</seg>
<seg type="foot" real="--">And in</seg>
<seg type="foot" real="++"> fresh num</seg>
<seg type="foot">bers num</seg>
<seg type="foot">ber all</seg>
<seg type="foot" met="-+-"> your graces,</seg>
<seg type="foot">The age</seg>
<seg type="foot"> to come</seg>
<seg type="foot"> would say</seg>
<seg type="foot"> ‘This po</seg>
<seg type="foot">et lies; </seg>
<seg type="foot">Such heaven</seg>
<seg type="foot">ly touch</seg>
<seg type="foot">es ne​'er</seg>
<seg type="foot"> touch​'d earth</seg>
<seg type="foot" met="-+-">ly faces’. </seg>
<lg type="quatrain">
<seg type="foot">So should</seg>
<seg type="foot"> my pap</seg>
<seg type="foot">ers,
<seg type="foot">owed with</seg>
<seg type="foot"> their age,</seg>
<seg type="foot">Be scorn​'d</seg>
<seg type="foot"> like old</seg>
<seg type="foot" real="+-"> men of </seg>
<seg type="foot">less truth</seg>
<seg type="foot"> than tongue; </seg>
<seg type="foot">And your</seg>
<seg type="foot"> true rights</seg>
<seg type="foot"> be term'</seg>
<seg type="foot"> a po</seg>
<seg type="foot">et​'s rage,</seg>
<seg type="foot">And stretch</seg>
<seg type="foot">ed me</seg>
<seg type="foot">tre of </seg>
<seg type="foot">an an</seg>
<seg type="foot">tique song. </seg>
<lg type="couplet">
<seg type="foot">But were</seg>
<seg type="foot"> some child</seg>
<seg type="foot"> of yours</seg>
<seg type="foot"> alive</seg>
<seg type="foot"> that time,</seg>
<seg type="foot">You should</seg>
<seg type="foot"> live twice-</seg>
<seg type="foot">in it,</seg>
<seg type="foot"> and in</seg>
<seg type="foot"> my rhyme. </seg>
Example 4. Adapted from a TEI P4 XML encoding by Mubina Islam (Islam 2004) of William Shakespeare’s poem “Sonnet 17” (Shakespeare 1978). TEI XML source not publicly available.


  • Blake, William. 1789. Songs of Innocence and of Experience. London: W Blake. Encoded and made available by the University of Virginia Library, Text Collection at
  • Browning, Robert. 1842. Dramatic Lyrics. London: Moxon.
  • Carroll, Lewis. 1865. Alice’s Adventures in Wonderland. New York: D. Appleton and co. p. 37.
  • Islam, Mubina. 2004. “A Selection of Sonnets: electronic edition encoded in XML with a TEI DTD.” Unpublished Master’s Dissertation, London: University College London.
  • Shakespeare, William. 1978. The Complete Works of William Shakespeare. Edited by Alexander, Peter. London: Collins.
  • Swinburne, Algernon Charles. 1924. Swinburne’s Collected Poetical Works. London: William Heinemann. p. 330–31.