Skip to content

Schema and validation ​

The rules on these pages are also written down as a schema, so that your XML editor can check your file while you encode. A file that passes the schema follows these guidelines: it uses the right elements, the allowed attribute values, and its IDs and pointers fit together.

The schema has two parts, and a file should pass both:

FileWhat it checks
ff-medieval_cuni-tei.rngRELAX NG schema. Which elements may appear where, which attributes are required, and which values are allowed (language codes, types, reasons…).
ff-medieval_cuni-tei.schSchematron rules. Rules the RELAX NG schema cannot express: mandatory parts of the header, ID prefixes, and whether pointers such as wit, hand, ref and ana lead to an existing ID.
ff-medieval_cuni-tei.oddSource of the RELAX NG schema. Only needed by those who maintain the schema.

Connecting a file to the schema ​

Put these two lines at the top of your file, right after the XML declaration, and keep both schema files in the same folder as your XML file. The quick start template already contains them.

xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="ff-medieval_cuni-tei.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="ff-medieval_cuni-tei.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0">
  <!-- … -->
</TEI>

Older files

Files started before version 2.0.0 point to tei_all. Replace their xml-model lines with the ones above, see what to change in existing files.

Validating a file ​

In Oxygen XML Editor open the file and choose Document › Validate › Validate (Ctrl+Shift+V, on a Mac ⌘+Shift+V). Oxygen reads the xml-model lines and checks the file against both parts of the schema; problems are listed at the bottom of the window and underlined in the text.

The Schematron rules report two kinds of problems:

  • Errors break a rule the guidelines call mandatory (“must”, “required”). The file is not finished until they are fixed.
  • Warnings point to a recommendation (“should”), for example an ID without the recommended prefix. Fix them unless you have a reason not to.

Fix from the top

One mistake often causes several messages, for example a witness without xml:id makes every wit pointing to it fail. Fix the first message and validate again.

What the schema checks ​

Required attributes ​

ElementAttributeSee
witnessxml:idWitness description
handNotexml:idHands description
divxml:langText structure
segxml:idSegments
addplaceAdditions
suppliedreasonSupplied

Allowed values ​

Only the values listed on the guideline pages are accepted:

AttributeAllowed values
xml:lang (everywhere)see Language abbreviations
objectDesc/@formbook, codex, composite_manuscript, roll, vellum, other
supportDesc/@materialparchment, paper, calfskin, goatskin, mixed
person/@sexmale, female, unknown
link/@typewiki, brit, academia, web
title/@typemain, sub, alt, short, desc
biblScope/@unitvolume, issue, page, line, chapter, part, column, entry
bibl/@type, biblStruct/@typemonography, book, article, thesis, dissertation, journal, edition
lb/@breakyes, no, maybe
name/@typeperson, place, org, author
measure/@typecurrency, volume, height, width, weight, depth, area, time
cit/@typeascribed, bible, example, literal, paraphrase (several can be combined)
add/@placeabove, below, lmargin, rmargin, interlinear
supplied/@reasonomitted-in-original, overbinding, faded-ink, lost-folio, burnt-hole-in-original, translation
gap/@reason, damage/@reasoncut-out, irrelevant, cancelled, fire, faded, deletion
unclear/@certhigh, medium, low, unknown

Rules of the guidelines ​

AreaErrorsWarnings
TEI Headertitle in titleStmt without xml:lang; publicationStmt without publisher, pubPlace (with country and settlement) or date with when; keyword term without type (genre, form) or xml:langtwo titles or keywords in the same language; Author_, Editor_, Edition_ prefixes; edition date without when
Witness descriptionmsIdentifier without country, settlement, institution or idno; msItem/title without xml:lang; handNote without pmsIdentifier without collection; Hand_ prefix; material outside the list above
People and placesperson, place, org without xml:id; placeName, geogName, orgName in the lists without xml:lang; geo not written as two numbers separated by a spacePerson_, Place_, Org_ prefixes; country without key
Bibliographyentry without xml:id or type; analytic or monogr without titleID without a prefix such as Bibl_; two titles with the same type and level
Text structurebody without a div type="original"; top-level div with a type other than original or translation; cit without quote; notBefore later than notAfternotBefore without notAfter, from without to; seg not described by any p corresp
Pointerswit not pointing to a witness in listWit; hand not pointing to a handNote; ref, target, source or ana pointing to an ID that does not exist; pointers written without #
Biblical citationscRef without refsDecl xml:id="biblicalCitations" or not matching its patternbook not abbreviated as in the Vulgata list; ref without decls="#biblicalCitations"
Translationsparagraph of the original without xml:id when a translation existstranslated paragraph without ana
Text correctionsexpan, corr, reg outside choice next to abbr, sic, orig; subst without both del and add

Differences from plain TEI ​

The LINDAT schema is a customisation of TEI P5: every file that passes it is TEI, with two exceptions that plain TEI (tei_all) would reject:

  • link may contain text and a single target, e.g. <link target="…" type="wiki">Wikipedia</link>. Plain TEI needs an empty link with at least two targets; use <ref type="wiki" target="…"> instead, see links.
  • damage may have a reason attribute. Plain TEI uses agent for this, see damaged text.

The schema also narrows TEI: it uses only the TEI modules these guidelines need, and allows only the values listed above where TEI would accept any value.

For schema maintainers ​

The RELAX NG schema is generated from ff-medieval_cuni-tei.odd; edit the ODD, never the .rng file directly. After changing the ODD, generate the schema again in one of these ways and save it as src/public/files/ff-medieval_cuni-tei.rng:

  • Roma: Customize › upload ff-medieval_cuni-tei.odd › Download › RELAX NG schema.
  • Oxygen: open ff-medieval_cuni-tei.odd › Configure Transformation Scenario › TEI ODD to RELAX NG XML.
  • TEI Stylesheets: bin/teitorelaxng ff-medieval_cuni-tei.odd ff-medieval_cuni-tei.rng.

The Schematron rules in ff-medieval_cuni-tei.sch are edited directly. Then validate the examples and the quick start template again, and record the change in the changelog.

Made by Martin Roček and Ondřej Fúsik