Validate an XML against a Schematron using PHP

坚强是说给别人听的谎言 提交于 2019-12-10 19:15:44

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!