Search code examples
sgmltei

TEI format vs. SGML format


Can anybody explain the difference between TEI and SGML format and/or how they are related?


Solution

  • In short TEI is XML, XML is SGML.

    The "G" in SGML (Standard Generalized Markup Language) means (among several other things) that a markup language may customize it syntax. For instance, you can define an SGML syntax where the tags (or elements) are like [v id:id1] instead of <v id="id1"></v>.

    XML is a concrete syntax of SGML, plus several other requirements that subset SGML. In XML (and HTML too) the elements are delimited by angular brackets: <body>. Each tag in XML must be paired with an explicit end tag: </body>.

    So far, we haven't talk about how the document is structured (the document type or schema). XML by itself does not impose restrictions on the document structure. The following is valid (i.e. well-formed) XML:

    <item>
       <body>
         <head>I don't know what I'm doing</head>
       </body>
    </item>
    

    TEI defines a common structure that all TEI documents must comply with, and assign a meaning to each tag. For instance:

    The actual text (<text>) contains a single text of any kind. This commonly contains the actual text and other encodings. A text <text> minimally contains a text body (<body>). The body contains lower-level text structures like paragraphs (<p>), or different structures for text genres other than prose [source]

    <text>
      <body>
        <p>For the first time in twenty-five years...</p>
      </body>
    </text>