eclipse-lemminx / lemminx

XML Language Server
Eclipse Public License 2.0
272 stars 93 forks source link

Support for Schematron validation #1338

Open adunning opened 2 years ago

adunning commented 2 years ago

With its Relax NG support (from #237), this language server is now extremely close to meeting the needs of a number of large XML initiatives such as DocBook, the Text Encoding Initiative, and Citation Style Language that largely expect users to edit XML files by hand, and being able to do this in everyday text editors would make an enormous difference. These rely on a combination of Relax NG and Schematron for validation. See the Schematron website for other examples.

Since LemMinX uses Jing for Relax NG, can its Schematron support be enabled easily? Jing only supports Schematron 1.5 rather than the finalized ISO Schematron, but according to their website support for ISO Schematron is coming.

For a list of validators covering ISO Schematron, see https://github.com/Schematron/awesome-schematron#software.

Thank you for all your work on this crucial piece of infrastructure!

angelozerr commented 2 years ago

Thanks @adunning for creating this issue.

@datho7561 already did some experimentation with Schematron, so it could give us some relevant feedback.

According @datho7561, Schematron requires Saxon for XSLT which grows the size of LemMinx uber JAR. We need to pay attention with this problem since vscode-xml is generaly used for XML, XSD, DTD.

We will see if RelaxNG is a lot used (by using telemetry, @rgrunber it should be nice to track that), and we will see if Schematron will become our priority.

Please vote for this issue if anybody are interested with Schematron.

adunning commented 2 years ago

It looks as if ph-schematron can operate without XSLT.

angelozerr commented 2 years ago

It looks as if ph-schematron can operate without XSLT.

Is it not a wrapper around to other Schematron implementation? We need to find time to investigate it.

adunning commented 2 years ago

There are several versions of ph-schematron, not all of which require Saxon. Its wiki explains the varying dependencies. Other Java implementations that do not appear to have other dependencies are https://github.com/itplr-kosit/validator and https://github.com/NASA-PDS/validate/.

There is also SaxonJS, which might be more lightweight than the full version. In this vein, there is an interesting implementation of Relax NG validation in TypeScript at https://github.com/mangalam-research/salve, used in the Scholarly XML extension for VS Code.

angelozerr commented 2 years ago

There is also SaxonJS, which might be more lightweight than the full version. In this vein, there is an interesting implementation of Relax NG validation in TypeScript at https://github.com/mangalam-research/salve, used in the Scholarly XML extension for VS Code.

@adunning we are in Java land because vscode-xml uses XML Language Server https://github.com/eclipse/lemminx so we cannot use TypeScript/JavaScript library.

The benefit with XML language server is that it can be consumed with other LSP client like Eclipse IDE, Sublime, etc which will benefit with RelaxNG support too and without having Java runtime because we provide binary to fix this problem.

denismaier commented 2 years ago

+1 for this feature