eXist-db / documentation

Documentation of eXist
13 stars 44 forks source link

switch to relaxng for validation #262

Closed duncdrum closed 4 years ago

duncdrum commented 6 years ago

What is the problem

Relax Ng is the normative format for db 5.0 and later. It makes subsetting a lot easier, the only reason we stuck with schema 1.0 no longer applies.

This would prevent users from validating their edits just to find that the valid element in their edits won't get rendered in the app.

see #238

Solution

switch to relax ng for validation during build.

Please provide the following

joewiz commented 5 years ago

I don't see RelaxNG assets in the app. oXygen uses its own built-in copy of the DocBook RelaxNG schema for validation:

[12:46:39] - <<< Start scanning using validation scenario
    Scenario Name: DocBook 5
    Document Type Name: DocBook 5
    Scenario Storage Type: Document Type Level
    Default Scenario: Yes
[12:46:39] - << Validation Unit (1 of 2):
    File to validate URL: file:/Users/joe/workspace/documentation/src/main/xar-resources/data/devguide_manifesto/devguide_manifesto.xml
    Validation Unit Type: XML Document
    Validation Unit Engine: <Default engine>
[12:46:39] - start scanning file:/Users/joe/workspace/documentation/src/main/xar-resources/data/devguide_manifesto/devguide_manifesto.xml with schema: file:/Applications/Oxygen%20XML%20Editor/frameworks/docbook/5.0/rng/docbook.rng
[12:46:39] - No problems found
[12:46:39] - Schematron Error Scanner - start scanning file:/Users/joe/workspace/documentation/src/main/xar-resources/data/devguide_manifesto/devguide_manifesto.xml with schema: file:/Applications/Oxygen%20XML%20Editor/frameworks/docbook/5.0/rng/docbook.rng
[12:46:39] - No problems found
[12:46:39] - >>
[12:46:39] - << Validation Unit (2 of 2):
    File to validate URL: file:/Users/joe/workspace/documentation/src/main/xar-resources/data/devguide_manifesto/devguide_manifesto.xml
    Validation Unit Type: XML Document
    Validation Unit Engine: Table Layout Validation
[12:46:39] - Table Layout Validation - start scanning file:/Users/joe/workspace/documentation/src/main/xar-resources/data/devguide_manifesto/devguide_manifesto.xml
[12:46:39] - No problems found
[12:46:39] - >>
[12:46:39] - End >>>

Am I right that the steps for this are:

  1. Add DocBook RelaxNG schema to the app
  2. Hook up mvn test to validate with these?

Also, it seems to me we have additional project-specific conventions that we could express in Schematron, e.g., the rule that links to other documentation pages should not have the .xml file extension. I can easily contribute such a rule, but can mvn test perform such validation too? (I'd also add, for the convenience of oXygen users, an oXygen project file which would include the full validation scenario.)

duncdrum commented 5 years ago

Yes, step one would be to create a subset db5 Schema of only the elements we use in relaxng and add that to the project. This includes some constraints for inline elements. Step 2 hook that up to mvn verify, which at the time of the op did not have full relax support. I could add that if it still hasn’t Step 3 validate the subset Schema against full, to make sure we still are valid db5.

As for schematron I don’t know if the current plugins support it. If not we ll find a way, via unit test if need be.

I have no objections to including an oxygen project file.

duncdrum commented 4 years ago

see #344 we could also increase build speeds by not running the diagnostics as unit tests