# Jing

## A RELAX NG validator in Java

Copyright © 2001, 2002, 2003, 2008 Thai Open Source Software Center Ltd

See the file copying.html for copying permission.

### Version 20091111

This version of Jing implements

- RELAX NG 1.0 Specification,
- RELAX NG Compact Syntax, and
- parts of RELAX NG DTD Compatibility, specifically checking of ID/IDREF/IDREFS.

Jing also has experimental support for schema languages other than RELAX NG; specifically

- W3C XML Schema (based on Xerces2-J);
- Schematron 1.5 (in a future version of Jing, the support for Schematron will be updated to support the ISO-standardized version of Schematron);
- Namespace Routing Language (in a future version of Jing, the support for NRL will be updated to support NVDL, which is an ISO-standardized schema language based on NRL).

A separate document describes this support in more detail.

Jing has a command-line user interface. It has no graphical user interface.

Jing is available for download as the file jing-20091111.zip, which contains binaries, source code and documentation. It requires a Java runtime compatible with the Java 2 Platform, Standard Edition (J2SE) version 1.4 (or any later version), such as the Java Runtime Environment (JRE), which can be downloaded here.

The latest version of Jing will always be available in the Downloads section of the project site.

Once you have installed a suitable Java runtime, you can run Jing by using the command:

    java -jar jing.jar options schema XMLfile...

where `schema` is the name of the file containing the schema, and `XMLfile...` are the names of one or more XML files to be validated against this schema, and `options` are zero or more options. If `schema` is correct, and each `XMLfile...` is valid with respect to `schema`, then Jing will generate no output. Otherwise, it will generate one or more error messages.

The following options are available:

`-c`
  The schema uses RELAX NG Compact Syntax.
`-e enc`
  Uses the encoding `enc` to read the schema.
`-f`
  Checks that the document is feasibly valid. A document is feasibly valid if it could be transformed into a valid document by inserting any number of attributes and child elements anywhere in the tree. This is equivalent to transforming the schema by wrapping every `data`, `list`, `element` and `attribute` element in an `optional` element and then validating against the transformed schema. This option may be useful while a document is still under construction. This option also disables checking that for every IDREF there is a corresponding ID.
`-i`
  Disables checking of ID/IDREF/IDREFS. By default, Jing enforces the constraints imposed by RELAX NG DTD Compatibility with respect to ID/IDREF/IDREFS.
`-t`
  Prints the time used by Jing for loading the schema and for validation.

When you use `jing.jar` with the `-jar` option, any jar files that have the same names as the jar files included with the Jing download and are in the same directory as `jing.jar` will be used automatically (i.e. they will be added to the classpath), specifically:

- `xercesImpl.jar`
- `xml-apis.jar`
- `saxon.jar`
- `isorelax.jar`

Note that, when using the `-jar` option, the JRE will ignore any additional class path entries specified by the `-cp` or `-classpath` options or by the `CLASSPATH` environment variable.

If you do not want use the `-jar` option (perhaps because you want to use some other `.jar` files not included with with Jing), then you must explicitly include all the needed `.jar` files with a `-cp` or `-classpath` option or with the `CLASSPATH` environment variable, and specify the main class name as `com.thaiopensource.relaxng.util.Driver`. For example, on Linux you could do you could do:

    java -classpath path-to-dist/jing-20091111/bin/jing.jar com.thaiopensource.relaxng.util.Driver file.rng file.xml

This would use just `jing.jar` and the standard Java classes.

Jing uses a vendor-independent pluggable datatypes API that allows datatype libraries to be added at runtime and be interoperable with Java-based RELAX NG implementation that supports the API.

Jing also includes an implementation of a datatype library for the W3C XML Schema Part 2 datatypes. There is a separate document describing this implementation and how to use it.

If you wish to use Jing in your programs, you have a choice.

- You can use Jing's native API.
- You can use JARV (Java API for RELAX Verifiers). JARV is part of the ISO-RELAX SourceForge project. Jing's implementation uses the 20041111 version. Support for DTD Compatibility validation of ID/IDREF and for validation with languages other than RELAX NG is not currently available via this interface.

There is a Jing task that allows Jing to be invoked by the Ant build tool.

Development of Jing, together with Trang, takes place in the jing-trang project, which is hosted on Google Code.

If you find a bug or would like to request an enhancement, please create a new issue in the Issues section of the project site. You can talk with other users of Jing on the rng-users mailing list.

If you want to make changes to Jing, you should check out the source code from the project's Subversion repository. (The source code included in the Jing download is for reference purposes, and doesn't contain the supporting files, such as build scripts and test cases, that are needed for working conveniently with the source code.)