问题
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:
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
来源:https://stackoverflow.com/questions/4822914/validate-an-xml-against-a-schematron-using-php