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:
For the above file, execute the following:
As a result, the following file was created:
I tested against this RNG file as follows.
OK: Different text content
NG: Missing title
NG: Has attributes
Summary
As shown above, it was possible to create an RNG file from a given XML file. While further study is needed on how to write RNG files, having a mechanism to experiment with concrete examples like these is valuable.
We hope this serves as a useful reference for learning about RNG files.