How do I perform schema validation using the Saxon java command line tool?
Expanding on the previous answer, because I needed to do this and it didn't provide enough information (and since my script is already doing a dozen XSL transformations - what are four more?)
Based on this website, the XML file can be schema validated using a series of XSL transformations. Since I also needed information on how to combine with Saxon - here are the Saxon modifications, window windows, with the catalog file.
This is how I run XSLT through the saxon command line on my computer (where FilePath is system dependent):
java -cp "C:\FilePath\saxon9ee.jar;C:\FilePath\resolver.jar";. net.sf.saxon.Transform -s:inputFile.xml -o:outputFile.xml -xsl:C:\FilePath\transform.xsl -catalog:"C:\FilePath\catalog.xml"
The most important thing to note is that when you use a saxon directory file, you must point it back to the resolver.jar file.
XSLT = java -cp "C:\FilePath\saxon9ee.jar;C:\FilePath\resolver.jar";. net.sf.saxon.Transform -catalog:"C:\FilePath\catalog.xml"
Then the information from the site makes sense (by finding the necessary xsl files in oXygen):
XSLT -input=xxx.sch -output=xxx1.sch -stylesheet=iso_dsdl_include.xsl XSLT -input=xxx1.sch -output=xxx2.sch -stylesheet=iso_abstract_expand.xsl XSLT -input=xxx2.sch -output=xxx.xsl -stylesheet=iso_svrl.xsl XSLT -input=document.xml -output=xxx-document.svrl -stylesheet=xxx.xsl
You take the schema file by running it through three transformations to get the xsl file, which is then run on the original xml document. This actually simplifies the script process.
The last command never filled the output file for me. Since it works fine without one and dumps messages to STOUT, I just leave it and collect the results from there.
Sorry for going into more details than this is possible, but I wish I had it all.
source to share