cwrc / CWRC-WriterBase

The base class from which to create a CWRC-Writer XML editor.
GNU General Public License v2.0
14 stars 3 forks source link

Explore replacing validator with a more recent microservice . #210

Open ilovan opened 4 years ago

ilovan commented 4 years ago

Comment from Jeff: current CWRC validator uses outdated libraries - may become expensive to maintain soon

Current validator: https://github.com/cwrc/cwrc-validator

lucaju commented 4 years ago

On a quick search for XML (RNG) validator on NPM, only one package is listed: Salve (https://www.npmjs.com/package/salve).

From their description page: “Salve (Schema-Aware Library for Validation and Edition) is a TypeScript library that implements a validator able to validate an XML document on the basis of a subset of Relax NG (RNG). It is developed as part of the Buddhist Translators Workbench. It can be seen in action in wed (http://mangalam-research.github.io/wed/). Salve is used for validating XML with custom Relax NG schemas. We've also validated files that use the TEI standard and the DocBook v5.0 schema.”

The package seems to be actively maintained (last updated 7 months ago), with the dev branch of their repo last updated a few hours ago. This seems to be part of a DH project and has been developed by Mangalam Research Center for Buddhist Languages at Berkeley, CA.

So, it might be a good candidate to be incorporated into CWRC Writer.

I was able to install the package and run it as a stand-alone app. In my first attempt to validate our "basic letter template” against the “cwrc_tei_lite.rng" results in a message with “invalid attribute value”. It might be some sort of setup issue or the way the schema is ingested. Perhaps @ajmacdonald can help with this. If not, we could contact the developer to see what I am doing wrong. Also, we might have to reword somethings in our end based on what type of response this tool produces.

lucaju commented 4 years ago

It might be difficult to find this type of validator in JS (see comment above). So I tried to find an XML RNG validator in other languages.

I thought I would find some information on the Relax NG homepage (https://relaxng.org/). However, it was last updated on Feb 2014. I'm not very confident I would find anything useful.

They do have a list of validators here - https://relaxng.org/#validators - mostly in C and Java. All of them pretty much outdated, which last updates varying from 2002 to 2012 (some with a broken link).

Since I not familiarized with XML validators nor with C and Java scripts, I am not sure if one of these would work.

lucaju commented 3 years ago

After a long research period, followed by a long development period, we adopt Salve as a Validator. We implemented it as a web-worker. This feature is currently on beta testing on https://dev-cwrc-writer.cwrc.ca/