4
votes

There are a lot of resources about Schematron... however I cant find anything related or an example on how to validate an xml against a Schematront .sch file.

Anyone?

I already found 1 or 2 very old classes that return errors... so if anyone knows how to do this, please help.

1
As far as O lknow Schematron schemas can be pre-compiled into XSL stylesheets and later run as any other transformation. (The result is the error report.)biziclop

1 Answers

2
votes

I use the 'ANT' option..

Build.xml

<project name="myName" default="all" basedir=".">
  <taskdef name="schematron"
          classname="com.schematron.ant.SchematronTask"
          classpath="lib/ant-schematron-2010-04-14.jar;lib/saxon9he.jar"/>

  <target name="all" description="test it">
    <schematron schema="sch/test.sch" failonerror="false" debugMode="true">
      <fileset dir="./xml" includes="*.xml"/>
    </schematron>
  </target>

</project>

debugMode=true shows you the intermediate XSLT file