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 20081028

This version of Jing implements

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

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-20081028.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:

The schema uses RELAX NG Compact Syntax.
-e enc
Uses the encoding enc to read the schema.
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.
Disables checking of ID/IDREF/IDREFS. By default, Jing enforces the constraints imposed by RELAX NG DTD Compatibility with respect to ID/IDREF/IDREFS.
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:

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-20081028/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.

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.)

James Clark