1
votes

I am using MarkLogic 8.0-8 version.

Is it possible to validate an XML using schematron?

Please help me with an example.

3

3 Answers

2
votes

There are XSLT stylesheets that are publicly available here to run Schematron validation:

https://github.com/Schematron/schematron

You can run these within MarkLogic. Though a little dated, here a project that shows how you could do it. It might still work:

https://github.com/ndw/ML-Schematron

HTH!

2
votes

Yes, as of MarkLogic 9.0.7, there is built-in support for Schematron.

http://docs.marklogic.com/schematron

To use the schematron XQuery library module as part of your own XQuery module, include the following lines in your XQuery prolog:

    import module namespace schematron = "http://marklogic.com/xdmp/schematron"
        at "/MarkLogic/schematron/schematron.xqy";

For more information and usage examples, see the Validating Schemas Using Schematron section in the Application Developers Guide.

1
votes

MarkLogic also packages a version of the Schematron validator with the appservices libraries. You can simply import it into a module:

import module namespace sch = "http://marklogic.com/validate" 
at "/MarkLogic/appservices/utils/validate.xqy"; 

sch:schematron($document, $schema)