# Jing task for Ant

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 Jing task for Ant allows you to efficiently validate multiple files against multiple RELAX NG patterns and integrate RELAX NG validation with other XML processing.

This version of the Jing task is for version 1.5 of Ant.

To use the Jing task, you must include a `taskdef` in your project file.

    <taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask"/>

The `jing` task has a required `rngfile` attribute which specifies the file containing the RELAX NG pattern. The files to be validated can be specified in two ways: the `jing` element may have a `file` attribute specifying a single file to be validated; alternatively, the `jing` 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="jing" classname="com.thaiopensource.relaxng.util.JingTask"/>

      <target name="validate">
        <jing rngfile="xslt.rng">
          <fileset dir="xsl" includes="**/*.xsl"/>
        </jing>
      </target>

    </project>

The `jing` task also has two optional boolean attributes:

`compactsyntax`
  if true, uses the compact syntax for the schema; default is false
`checkid`
  if true, checks for ID/IDREF/IDREFS compatibility; default is true

When invoking Ant, you must ensure that `jing.jar` is in your class path.