JARV comes with an Ant task implementation that makes it easy to use Ant to automate validation. This document describes how you can use it.
... ...
First, you need to declare org.iso_relax.ant.JARVTask
as a task by using a taskdef
task. You should also specify the jar file of the validator implementation you'll be using. In this example, MSV is specified.
To validate documents with a schema, you need to specify three parameters. A schema language (by the schemaLanguage
attribute), a schema file (by the schema
attribute), and XML files to be validated.
A schema language is specified by passing its name, which is usually its namespace URI. Refer to this list for the names of major schema languages.
XML files can be specified either by a file attribute or by nested fileset
elements. The latter allows multiple files to be specified easily. See the documentation of Ant for details of the syntax of fileset
.
The JARV task supports the following parameter attributes.
Attribute | Description | Required |
schemaLanguage | Specifies the schema language of the schema file. See this list for possible values. | Yes |
schema | Specifies the name of a schema file that validates documents. | Yes |
file | Specifies a XML file to be validated against the specified schema. | No |
Following nested element parameter is supported.
Specifies the set of files that will be validated against the schema. Multiple fileset
elements can be specified. For the syntax, see the ant documentation.
By specifying neither a file attribute or nested file sets, you can check the correctness of the specified schema file.