Ant is a Java based build tool, which is becoming the build tool of choice for Java-based projects. Ant project files are written in XML.
Ant can be extended with new tasks. The TREX task for Ant allows you to efficiently validate multiple files against multiple TREX patterns and integrate TREX validation with other XML processing.
This version of the TREX task is for version 1.2 of Ant.
To use the TREX task, you must include a taskdef
in your project file.
<taskdef name="trex" classname="com.thaiopensource.trex.util.TrexTask"/>
The trex
task has a required trexfile
attribute which specifies the file containing the TREX pattern. The
files to be validated can be specified in two ways: the
trex
element may have a file
attribute
specifying a single file to be validated; alternatively, the
trex
element may have one or more fileset
child elements specifying sets of files to be validated. For
example:
<project name="example" default="validate" basedir="."> <taskdef name="trex" classname="com.thaiopensource.trex.util.TrexTask"/> <target name="validate"> <trex trexfile="trex/xslt.trex"> <fileset dir="xsl" includes="**/*.xsl"/> </trex> </target> </project>
When invoking Ant, you must ensure that trex.jar
is in
your class path, along with a jar file containing the SAX2
classes.