Closed robertmarkbram closed 3 years ago
Well it depends on what you wanna do... Validate an XML document, create your own Schematron rule or do something less obvious? If you want to validate XML documents - is there a particular kind of document to validate, or do you want to validate any kind of document. Are the rules fixed or do you want to play with different rules?
Questions over questions. Philip ;-)
Thanks Phillip,
Currently, validate XML documents with a .sch file I will create.
Am just starting to explore Schematron so not too familiar with what it can do yet, apart from being a way to validate XML by checking it against all the rules you write in a .sch file.
Rob :)
Okidoki. There are basically two ways you can start from 1) Using the XSLT based implementation - that is the most generic way forward - you can use all the XSLT functions you like within your Schematrons 2) Using the pure Java implementation - in that scenario you are limited to XPath functionality in your Schematrons.
Assuming version 1) is more suitable in a generic manner.
So in your pom.xml you need https://github.com/phax/ph-schematron/wiki#ph-schematron-xslt
As a quick example on how to perform validation, I suggest you look at https://github.com/phax/ph-schematron/blob/master/ph-schematron-xslt/src/test/java/com/helger/schematron/supplementary/Issue008Test.java - it provides you with the very basic tools.
Some documentation is also available at https://phax.github.io/ph-schematron/ - I should move it to the Wiki...
Thanks!
I will check those out.
Am looking for some sample code to give me an idea how to use this API.
Rob :)