Overview

One of the editors for TEI/XML is LEAF-WRITER.

https://leaf-writer.leaf-vre.org/

It is described as follows:

The XML & RDF online editor of the Linked Editing Academic Framework

The GitLab repository is below.

https://gitlab.com/calincs/cwrc/leaf-writer/leaf-writer

One of the features of this tool is described as:

continuous XML validation

This validation appears to use the following API.

https://validator.services.cwrc.ca/

The library seems to be:

https://www.npmjs.com/package/@cwrc/leafwriter-validator

This time, I tried the above API.

Testing

The following page is displayed.

https://validator.services.cwrc.ca/

I tested the following with the Try It POST function.

Schema URL: https://raw.githubusercontent.com/nakamura196/test2021/main/tei_excel.rng Schema Type: RNG_XML Document Content:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml"
	schematypens="http://purl.oclc.org/dsdl/schematron"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0">
   <teiHeader>
      <fileDesc>
         <titleStmt>
            <title>Title</title>
         </titleStmt>
         <publicationStmt>
            <p>Publication Information</p>
         </publicationStmt>
         <sourceDesc>
            <p>Information about the source</p>
         </sourceDesc>
      </fileDesc>
   </teiHeader>
   <text>
      <body>
         <p>
            I am <name>Satoru Nakamura</name>.
         </p>
      </body>
   </text>
</TEI>

The above would not produce an error when using http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng as the schema, but should produce an error with https://raw.githubusercontent.com/nakamura196/test2021/main/tei_excel.rng which limits the available tags.

Please also refer to the following.

As a result, an error was returned as shown below. The reason that the name tag is incorrectly used was also returned.

<?xml version="1.0" encoding="UTF-8"?>
<validation-result>
  <status>fail</status>
  <warning>
    <line>22</line>
    <column>24</column>
    <message>element "name" not allowed anywhere; expected the element end-tag, text or element "choice", "date", "label", "lb", "note", "orig", "pb", "persName", "placeName", "reg", "ruby", "seg", "space" or "title"</message>
    <element>name</element>
    <path>/TEI/text[1]/body[1]/p[1]/name[1]</path>
  </warning>
</validation-result>

Summary

I hope this is helpful for implementing TEI/XML validation functionality.