ODD Editing Tips: Part 1

Restricting an Element’s Attributes to Specific Ones Only By default in TEI, elements inherit many attribute classes (att.global, att.datable, etc.), making numerous attributes available. If you want to allow only specific attributes, configure it as follows. Example: Allowing Only xml:id and corresp on persName < e / l < < e e c / a / l m l < < < < < < < c t < < a e e a ! m m m m m m l t a / a / t m n s - e e e e e e a L t < < a t < < a t e t s - m m m m m m s i t d d / t t d d / t L n S e b b b b b b s s D e a < d t D e a < d t i t p s 属 e e e e e e e t e s t d a D e s t d a D s S e 性 r r r r r r s > f c a a t e f c a a t e t p c m ク O O O O O O > > t t a f > t t a f > e o ラ f f f f f f i 要 y a t > i 関 y a t > c i d ス d 素 p R y d 連 p R y > d e を k k k k k k e の e e p e す e e p e = 削 e e e e e e n 一 > f e n る > f e n " 除 y y y y y y t 意 > t 人 > t c ( = = = = = = = な n = 物 k = h モ " " " " " " " 識 a " 情 e " a デ a a a a a a x 別 m c 報 y p n ル t t t t t t m 子 e o へ = e g ク t t t t t t l < = r の " r e ラ . . . . . . : / " r リ t s " ス g c d e p t i d I e ン e N > は l m a d e y d e D s ク i a 維 o c t i r p " s " p < d m 持 b " a t s e c / " / a e ) a b L o d m > > d t " l m l i n " o m e a " o e k a d o s . m d " e l m e d c p o m e " " o = e > o d o = m d " = i e d " o m m e a " n = e d d o o = d a t " = e e d d " d d e c " l = e e d " d r h d e " = = e " " a e t d " " l u / n l e e d d e s u > g e " l e e t a s e t / e l l e g a " e > t e e " e g > " e t t / = e / " e e > " = > / " " o " > / / p o > > t p " t > " > Key Points Use <classes mode="change">: If you use mode="replace" and leave it empty, the model classes will also be deleted, making the element itself unusable Delete attribute classes individually: Remove unnecessary attribute classes with <memberOf key="att.xxx" mode="delete"/> Add required attributes: Define the attributes you want to allow with <attDef ident="xxx" mode="add"> Notes You can check which attribute classes an element belongs to in the TEI Guidelines Deleting att.global will also remove xml:id, xml:lang, etc., so add them individually as needed Adding Attributes to an Element When adding a new attribute while keeping existing attribute classes: ...

January 27, 2026 · 5 min · Nakamura

Constraint Design for IIIF-Compatible Facsimile Description Using TEI ODD

Introduction When describing metadata for digital images in TEI (Text Encoding Initiative), the facsimile element is used. Particularly in IIIF (International Image Interoperability Framework) compatible digital archives, it is important to properly describe references to manifests, canvases, and the Image API. This article introduces how to define the constraints needed for facsimile descriptions as a schema using ODD (One Document Does it all). Guidelines Followed This ODD is based on the “Linking with IIIF Images” specification introduced in the Japanese TEI guidelines: ...

December 10, 2025 · 15 min · Nakamura

TEI ODD File Customization: A Case Study with NDL Classical Book OCR

Introduction TEI (Text Encoding Initiative) is an international standard for digitizing and sharing texts in humanities research. This article introduces the process of customizing a TEI ODD file to match the output format of the NDL Classical Book OCR-Lite application. ODD (One Document Does it all) is a mechanism for customizing TEI schemas, allowing you to define your own schema containing only the necessary elements and attributes. Background: Development of the NDL Classical Book OCR-Lite Application I am creating an application that outputs NDL Classical Book OCR-Lite results in TEI/XML. The purpose of this application is to perform OCR on Japanese classical books and output the results in standard TEI format. ...

September 5, 2025 · 22 min · Nakamura

Development of the NDL Kotenseki OCR-Lite Next.js Version

Overview @yuta1984 developed a “WebAssembly-based web port of NDL Kotenseki OCR-Lite”: https://github.com/yuta1984/ndlkotenocr-lite-web Using the above repository as a reference, I created a Next.js version: https://nkol.vercel.app/ja/ In addition, the following features have been added: IIIF manifest file input form TEI/XML file download functionality Creation of an ODD file for the output format Usage As an example, we use the Tale of Genji from the Kyushu University Library: https://catalog.lib.kyushu-u.ac.jp/image/manifest/1/820/411193.json After entering the manifest file and clicking the “Load” button, a list of images is displayed as shown below: ...

September 1, 2025 · 3 min · Nakamura

Implementation Guide for TEI XML Schema Combining RELAX NG and Schematron

! After manual verification, an AI wrote this article. Introduction When editing TEI (Text Encoding Initiative) XML, in addition to structural validation of elements and attributes, more complex business rule validation may be needed. This article explains how to combine RELAX NG (RNG) and Schematron to achieve both structural and content validation, using challenges encountered in an actual project as examples. The Problem to Solve When editing classical Japanese literary texts in TEI XML, the following requirements arose: ...

August 9, 2025 · 20 min · Nakamura

Creating Project-Specific RNG Files Using Generative AI

Overview When editing TEI/XML files, changing the RNG file used for validation allows you to limit the tags and attributes available. This offers benefits such as preventing workers from being confused by tag choices and reducing inconsistencies in the created TEI/XML. As a method for editing RNG files, using Roma is common, as introduced in the following article. This is a top-down approach to limiting available tags and attributes, but this time we try creating an RNG file bottom-up from existing TEI/XML using generative AI. ...

August 1, 2025 · 37 min · Nakamura

Using Roma to Restrict Allowed Values for Tag Attributes

Overview This is a memo on how to restrict the allowed values for tag attributes using Roma. Background In the following article, I described how to restrict the attributes available for a tag. For example, making only the key and type attributes available for the persName tag. In this article, I go further to restrict the allowed values for specific attributes. For example, allowing only “right marginal note” or “left marginal note” to be set for the type attribute. ...

October 28, 2024 · 1 min · Nakamura

Using Roma to Restrict Attributes for Tags According to Your Project

Overview This is a personal note on how to restrict attributes used for tags according to your project using Roma. Background In the following article, I described how to restrict tags according to your project using Roma. This time, as an extension of that, we will customize the attributes used for each tag. Use Case Here, as an example, we will try restricting the available attributes for persName. When using the default (tei_all.rng) with Oxygen XML Editor, as shown below, many options are presented as available attributes for the persName tag. ...

October 28, 2024 · 7 min · Nakamura

RELAX NG and Schematron

Overview When creating TEI/XML with oXygen XML Editor, the following template is generated. < < < < ? ? ? s T / x x x c E < < T m m m h I t / t / E l l l e e t e t I - - m x i e x e > v m m a m H < i t < x e o o t l e f / H > b / t r d d y n a i f e o b > s e e p s d l < < < i a d < o i l l e = e e t / p / s / l d y p d o n " r D i t u p o s e e > > y n h h s h > e t < i b < u u < o D r S > = r r = t s l t t l p b r p u e > o " e e " t c e i l i > l c > r s m 1 f f h p > S t e c P i e I c c e . = = t : t l S a u c D n e > 0 " " t / m e t t b a e f D t " h h p / t > m i l t s o e e t t : w > T t o i i c r s x e t t / w i > n c o > m c t n p p / w t S a n a > c : : p . l t t S t h o / u t e m i t i e d / r e < t o m o r i w w l i / > n t n e n w w . - t > . g w w o c i I a < = . . c . t n b / " t t l o l f o p U e e c r e o u > T i i . g > r t F - - o / m - c c r n a t 8 . . g s t h " o o / / i e ? r r d 1 o > g g s . n s / / d 0 < o r r l " / u e e / > p r l l s > c e e c e a a h < s s e / e e m p / / a > x x t m m r l l / n t t " e e ? i i > / / c c u u s s t t o o m m / / s s c c h h e e m m a a / / r r e e l l a a x x n n g g / / t t e e i i _ _ a a l l l l . . r r n n g g " " t t y y p p e e = = " " a a p p p p l l i i c c a a t t i i o o n n / / x x m m l l " " s c h e m a t y p e n s = " h t t p : / / r e l a x n g . o r g / n s / s t r u c t u r e / 1 . 0 " ? > I was curious about the following difference, so I am sharing the results of querying GPT-4. ...

May 16, 2024 · 8 min · Nakamura

Using Roma to Limit Tags for Your Project and Generate Documentation

Overview I previously explained how to use Roma in the following article. This time, I will explain the workflow for creating TEI ODD (One Document Does-it-all) and documentation (HTML and PDF) targeting TEI/XML files at hand. Note that at the end of this article, I have included GPT-4’s response regarding the differences between ODD (One Document Does it all) and RNG (RelaxNG). Please refer to that as well. Obtaining a List of Tags Used First, obtain a list of tags used in your project. ...

November 3, 2023 · 12 min · Nakamura

Trying the jingtrang Library for RELAX NG Schema: Creating RNG Files

Overview In the following article, I performed XML file validation using jingtrang and RNG files. Since this jingtrang library can create RNG files from XML files, I decided to try it out. I also prepared a Google Colab notebook. https://colab.research.google.com/github/nakamura196/ndl_ocr/blob/main/jingtrangを試す:作成編.ipynb Creating an RNG File As the source file for creating the RNG file, I prepared the following: < r o o t > < t i t l e > a a a < / t i t l e > < / r o o t > For the above file, execute the following: ...

January 18, 2023 · 4 min · Nakamura

Trying the jingtrang Library for RELAX NG Schema: Validation

Overview I had an opportunity to create an XML file conforming to a specific schema, and needed to verify that the XML file matched the schema. To meet this requirement, I tried the jingtrang library for working with RELAX NG schemas, so here are my notes: https://pypi.org/project/jingtrang/ I also prepared a Google Colab notebook: https://colab.research.google.com/github/nakamura196/ndl_ocr/blob/main/jingtrangを試す.ipynb Trying Validation # p # w # w i g g ラ p r e v e イ n t a t ブ i g l ラ n フ h i h リ s ァ t d t の t イ t a t イ a ル p t p ン l の s i s ス l ダ : o : ト ウ / n / ー j ン / 対 / ル i ロ r 象 k n ー a の o g ド w X u t ( . M i r t g L g a e i フ e n i t ァ n g _ h イ j a u ル i l b の m l u 用 o を s 意 n 使 e ( o 用 r 校 g ) c 異 a o 源 t n 氏 a t 物 r e 語 i n テ . t キ g . ス i c ト t o の h m ダ u / ウ b n ン . a ロ i k ー o a ド / m ) t u e r i a / 1 0 9 1 6 . / x t m e l s t 2 0 2 1 / m a i n / t e i _ a l l . r n g Passing Example Running the following produced no output: ...

January 18, 2023 · 3 min · Nakamura