RELAX NG Pluggable Datatype Library Example

This package contains a very simple example of a pluggable datatype library. The datatype library is implemented by the class com.thaiopensource.datatype.sample.BalancedString. The bulk of the implementation is inherited from the abstract class com.thaiopensource.datatype.sample.SimpleDatatypeLibrary, which provides default implementations for the methods in the interfaces which a datatype library must implement. A class that derives from SimpleDatatypeLibrary has only to implement a boolean isValid(String literal) method. The datatype library has the URI http://www.thaiopensource.com/relaxng/datatypes/sample, and contains exactly one datatype, which is called balancedString. This datatype allows any string in which parentheses are properly balanced (nested). To use this sample datatype library, simply include datatype-sample.jar in your CLASSPATH. You will then be able to validate against schemas using this additional datatype. The file datatype-sample.rng is a simple RELAX NG schema using this datatype; valid.xml is an instance that is valid with respect to this schema; invalid.xml is an instance that is not valid with respect to this schema.

James Clark