Jing support for XML Schema Datatypes

Jing contains a built-in implementation of the W3C XML Schema Part 2 Recommendation. Jing follows the Guidelines for using W3C XML Schema Datatypes with RELAX NG.

The implementation of the pattern facet (and of some of the more complicated datatypes) requires an implementation of regular expressions as defined in XML Schema Part 2. Jing provides implementations based on:

Jing will automatically use the first of the above implementations for which the necessary classes are available on your CLASSPATH.

You can interface a different implementation of XML Schema regular expressions by implementing the interface com.thaiopensource.datatype.xsd.RegexEngine. Jing finds an implementation of this interface using the service provider technique: a JAR file containing an implementation of this interface must contain a file META-INF/services/com.thaiopensource.datatype.xsd.RegexEngine that contains the name of class that implements the interface. Jing will automatically find and use the implementation if the JAR file is added to the CLASSPATH.

For example, you can use IBM's Regex for Java package, available from Alphaworks. You can create a RegexEngine that uses this simply by changing org.apache.xerces.utils to com.ibm in com/thaiopensource/datatype/xsd/regex/xerces/RegexEngineImpl.java. The sample implementation does not include such a class because the license for Regex for Java is currently rather restrictive.