6 Exercise: Basic encoding.

6.1 Instructions

Follow the step-by-step instructions below to encode a text, a sonnet by Lope de Vega. Before you start, download (right click on link > save link as) to your computer, in a folder that you can easily locate, the following files:

6.2 Tool: VScode

If not already done, install Visual Studio Code; see the instructions in the Appendix A.

You need to install also the extensions Scholarly XML and XML Tools. View > Extensions > Search extensions in the Marketplace.

  • Open the file TEI-File.xml in VScode (ie., drag and drop it to VSCode)
  • Change the name (directly or in File > Save As. Keep the extension .xml)
  • Tip: save it in the same place of the exercise.

6.3 Transcription

  • Remove the dummy text “Some text here.” between the opening <p> and the closing </p> within the <body> element.
  • Copy (or transcribe directly) the text into the opening <p> and the closing </p>.

The document should be now well-formed (✓ XML Valid on the bottom left-hand corner).

6.4 Encoding

You are encoding a sonnet, so you need to add these elements:

<l>: verse line. <lg>: line group (verse lines functioning as a formal unit, e.g.: sonnet: 14 verses lines; quatrain: 4 verses lines; tercet: 3 verses lines).

  • Start removing the opening <p> and the closing </p>, we don’t need them for a sonnet.
  • Don’t worry about the error ⓧ XML is not valid (it means the document is not, yet, well-formed).
  • Surround the first verse line with a the opening <l> and the closing </l>.
  • Proceed the same way with all lines.
  • Tip! You can try a shortcut: Highlight the verse line, press Ctrl/CMD-e, and in the contextual menu type ‘l’, for the element name).

The document should be now well-formed (✓ XML Valid on the bottom left-hand corner).

  • Now encode all line groups, i.e., the sonnet, the 2 quatrains and 2 tercets. Surround with <lg> </lg> all verses lines (that is the whole sonnet) and go on successively for each quatrain and tercet. The structure should look like:
  • Add now the attributes to mark up the strophes and the number lines (remember to add the quotation marks):

<lg type="sonnet">: line group for the whole poem. <lg type="quatrains">: line group for a quatrain. <lg type="tercets">: line group for a tercet. <l n="1">: verse line number.

6.5 Metadata (<teiHeader>).

Add some descriptive information to your file, e.g., a title to your edition.

  • Add a tittle and an author: titleStmt -> title, titleStmt -> author.

  • Add some bibliographic information to your file. Use the bibliographic information provided in the transcription file.


It is possible to add all bibliographic information in <bibl>, but if you want to be more precise, you can annotate it with other tags and attributes

<editor role="tłumacz">

6.6 Already finished?

Violante or Violente? ‘Violente’ in the Polish version is a typo, so go for it and encode the correction.

  • Search in the TEI Guidelines for a solution looking for ‘choice’ (<choice>, <sic>, <corr>).

6.7 Encoded sonnet

<lg type="sonnet">
  <lg type="quatrain">
     <l n="1">Bym złożył sonet, 
        </choice> mię prosi;</l>
     <l n="2">nierazem znoił w takowym rygorze:</l>
     <l n="3">czternaście wierszów sonet pojąć może.</l>
     <l n="4">Trzy z przodka fraszka ze śmiechem unosi.</l>
  <lg type="quatrain">
     <l n="5">Trapiąc się, jaki rym tutaj położę,</l>
     <l n="6">do drugiej strofy dobiegam w rozpędzie.</l>
     <l n="7">Niech mi tercyna z odsieczą przybędzie,</l>
     <l n="8">a oną strofą nic się nie zatrwożę.</l>
  <lg type="tercet">
     <l n="9">W pierwszą tercynę wchodzę i chociażem</l>
     <l n="10">za próg przełożył, zda się, jedną nogę,</l>
     <l n="11">już tę tercynę gładko zamknąć mogę.</l>
  <lg type="tercet">
     <l n="12">Drugiej dostawszy, z jednakim kurażem</l>
     <l n="13">– chocia naprzeciw wiersz trzynasty bieży –</l>
     <l n="14">czternasty-m skroił! Licz kto mi nie wierzy!</l>